How to install php5.6 in ubuntu 16.04 with php7? - ubuntu-14.04

I have got a problem, a few months ago I updated ubuntu 14.04 to 16.04, and my php5.6 from LAMP had problems working next to php7, so I removed it. New projects are fine now, but if I am trying to update composer in older projects, console returns error... Content below:
Problem 1
- Installation request for simpay/api_client dev-master -> satisfiable by simpay/api_client[dev-master].
- simpay/api_client dev-master requires ext-curl ^0.0.0 -> the requested PHP extension curl has the wrong version (7.0.8-0ubuntu0.16.04.3) installed.
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/15-xml.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-curl.ini
- /etc/php/7.0/cli/conf.d/20-dom.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gd.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-simplexml.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
- /etc/php/7.0/cli/conf.d/20-wddx.ini
- /etc/php/7.0/cli/conf.d/20-xmlreader.ini
- /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
- /etc/php/7.0/cli/conf.d/20-xsl.ini
- /etc/php/7.0/cli/conf.d/20-zip.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
It will be possible to install php5.6 without any problems? And make alias for example php5? How to do it?

Just install php5.6 with apt-get. I got my instructions from here.
Be sure to use ondreij's ppa repository. This way php7.0 and php5.6 are installed side by side as completely separate packages.
I am on a fresh 16.04 install. I installed php7.0 and all needed extensions. Today I installed php5.6 and made aliases to switch back and forth between the two versions. Put this in ~/.bash_aliases and reload it.
alias enablephp5.6="sudo ln -s -f /usr/bin/php5.6 /etc/alternatives/php"
alias enablephp7.0="sudo ln -s -f /usr/bin/php7.0 /etc/alternatives/php"
So now when running php from console or when using composer install you can enable the correct version. It works perfectly for me.
If you need additional php5.6 extensions just install them with sudo apt-get install php5.6-<extension>.

Related

How to install conda packages in the aarch64 from x86-64 architecture

May I know how can I get the installed packages from a particular environment from x86-64 architecture linux and
how can I create a new conda environment in aarch64 architecture using the same package?
First in the x86-64 architecture linux machine called L2, I export the package
conda list --export > envconda.txt
When I open the envconda.txt, it is
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=main
_r-mutex=1.0.0=anacondar_1
I changed the platform : linux-64 to linux-aarch64 because I am going to install the packages in the aarch64 architecture.
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-aarch64
_libgcc_mutex=0.1=main
_r-mutex=1.0.0=anacondar_1
In aarch64 linux machine called L1, I create a conda environment
conda create -n envtest --file envconda.txt
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- setuptools==36.4.0=py36_1
- kiwisolver==1.1.0=pypi_0
- pyyaml==3.13=pypi_0
- jedi==0.10.2=py36_2
- libgcc==5.2.0=0
- jsonschema==2.6.0=py36_0
- ptyprocess==0.5.2=py36_0
- prompt_toolkit==1.0.15=py36_0
- libstdcxx-ng==9.1.0=hdf63c60_0
- tqdm==4.36.1=pypi_0
- tomli==1.2.3=pypi_0
- astor==0.7.1=pypi_0
- argparse==1.4.0=pypi_0
- pycparser==2.19=pypi_0
- testpath==0.3.1=py36_0
- cudnn==7.6.5=cuda10.2_0
- asn1crypto==0.22.0=py36_0
- dataclasses==0.8=pypi_0
- platformdirs==2.4.0=pypi_0
- krbcontext==0.10=pypi_07
- decorator==4.1.2=py36_0
- lazy-object-proxy==1.7.1=pypi_0
- gsl==2.2.1=0
- pexpect==4.2.1=py36_0
- icu==54.1=0
- freetype==2.5.5=2
- bleach==1.5.0=py36_0
- matplotlib==3.1.1=pypi_0
- wheel==0.29.0=py36_0
- cudatoolkit==10.2.89=hfd86e86_1
- glib==2.50.2=1
- kneed==0.7.0=pypi_0
- sqlite==3.13.0=0
- importlib-metadata==1.7.0=pypi_0
- python==3.6.2=0
- jpeg==9b=0
- pango==1.40.3=1
- fontconfig==2.12.1=3
- resampy==0.2.2=pypi_0
- nbformat==4.4.0=py36_0
- pixman==0.34.0=0
- scikit-learn==0.21.3=pypi_0
- termcolor==1.1.0=pypi_0
- typed-ast==1.5.4=pypi_0
- keras-applications==1.0.8=pypi_0
- harfbuzz==0.9.39=2
- libffi==3.2.1=1
- jupyter_client==5.1.0=py36_0
- gssapi==1.6.9=pypi_0
- curl==7.54.1=0
- keras==2.2.4=pypi_0
- isort==5.10.1=pypi_0
- simplegeneric==0.8.1=py36_1
- joblib==0.14.0=pypi_0
- pypandoc==1.6.3=pypi_0
- python-dateutil==2.8.2=pypi_0
- ipython_genutils==0.2.0=py36_0
- pyparsing==2.4.2=pypi_0
- ca-certificates==2022.6.15=ha878542_0
- krb5==1.13.2=0
- path.py==10.3.1=py36_0
- markdown==3.0.1=pypi_0
- requests-kerberos==0.12.0=pypi_0
- hdfs==2.5.8=pypi_0
- traitlets==4.3.2=py36_0
- tornado==4.5.2=py36_0
- librosa==0.7.0=pypi_0
- pyasn1==0.4.8=pypi_0
- blas==1.0=mkl
- zlib==1.2.11=0
- libogg==1.3.2=h14c3975_1001
- mkl==2017.0.3=0
- terminado==0.6=py36_0
- libflac==1.3.1=hf484d3e_1002
- python-levenshtein==0.12.2=pypi_0
- werkzeug==0.14.1=pypi_0
- pyspark==2.3.2=pypi_0
- urllib3==1.26.9=pypi_0
- bzip2==1.0.6=3
- html5lib==0.9999999=py36_0
- pywavelets==1.1.1=pypi_0
- zeromq==4.1.5=0
- pykerberos==1.2.1=pypi_0
Current channels:
- https://repo.anaconda.com/pkgs/main/linux-aarch64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/linux-aarch64
- https://repo.anaconda.com/pkgs/r/noarch
- https://conda.anaconda.org/conda-forge/linux-aarch64
- https://conda.anaconda.org/conda-forge/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
May I know how can I install the packages successfully in the aarch64 architecture?
Last but not least, when I install package using pip install numpy, I got this error Illegal instruction (core dumped)
For this issue, may I know how can I solve this also in linux aarch64 architecture?
Very unlikely this will work for multiple reasons:
Package support off the major platforms (osx-64, linux-64, win-64) is sparse, especially further back in time. A concrete example is cudatoolkit, which only has linux-aarch64 builds starting with version 11.
Overgeneralized environment. The more packages included in an environment, the more difficult it becomes to solve it, and solving across platforms aggravates this problem. I would, for example, remove any Jupyter-related packages completely. In the future, try to plan ahead to have dedicated environments to specific projects, and only install the packages that are absolutely required.
Some packages are completely incompatible. For example mkl is architecture specific.
Nevertheless, if you want to attempt recreating an approximation of the environment, there are some options. First, one cannot achieve this with conda list --export - that simply does not handle environments that have packages from PyPI installed.
PyPI-centric Approach
Because so much of the environment is from PyPI, my first inclination is to recommend abandoning the Conda components and going a pip route. That is, use
pip list --format=freeze > requirements.txt
to capture the Python packages, then create a new environment with something like:
environment.yaml
name: foo
channels:
- conda-forge
- nodefaults
dependencies:
- python=3.6
- pip
- pip:
- -r requirements.txt
With both requirements.txt and environment.yaml in the same folder, the environment is created with
## "foo" is arbitrary - pick something descriptive
conda env create -n foo -f environment.yaml
Retaining some Conda packages
You could also try keeping some parts from Conda by mixing together a conda env export and the previous pip list. Specifically, export a minimal environment definition, with
conda env export --from-history > environment.yaml
Edit this file to include a specific version of Python, remove any packages that are not available for linux-aarch64 (like mkl), and add the pip: section, as above:
environment.yaml
#...
dependencies:
- python=3.6
# ...
- pip
- pip:
- -r requirements.txt
This is then used with:
conda env create -n foo -f environment.yaml
Expect to iterate several times to discover what cannot be found for the platform. I would strongly recommend using mamba instead of Conda in order to minimize this solving time.

Team City "minimal build agent" Docker image - "npm: not found" Linux issue?

First of all, I think this is more of a Linux issue as the problem seems to be on a linux-flavoured Docker container, but I'm happy to accept that I can do something to the team city config to overcome this.
I'm also not very experienced with Linux, Docker or node/npm, though I do have a lot of development experience and am very comfortable with command line interfaces in general.
Background
We currently have Team City set up as a build server, for building a variety of projects:
.Net Framework,
.Net Core
Angular CLI
A couple of simple websites which use node packages to generate HTML from Markdown.
The server is running as a Docker container using Docker for Windows on a Windows Server box, and this is working well.
We have one Windows 10 Build agent (a VM) which is also working fine, and builds all the .Net and .Net Core stuff fine.
The simple docs site stuff primarily uses the markdown-to-html node package, so its build steps simply get all the source .md files and compile to html with markdown-to-html, plus use some other npm packages for SASS compilation and minification of js etc. No actual node code as such, just some jQuery. In order to not tie up the other agent, and because this stuff can run happily on Linux, I want to have this running on a small docker image rather than a full VM build agent somewhere.
I previously successfully used a node.js team city agent docker image (either jacobpeddk/teamcity-agent-nodejs or omez/teamcity-agent-nodejs - can't recall) which did work for a time, though I had issues with being able to install some npm packages globally in build scripts, which meant I had to get a bash terminal into the container and run some manual npm commands. I also I think had to run apt-get install zip to get a zipping step to work. This worked fine for a while (weeks).
I added some extra JS stuff to one of these simple projects, and suddenly I was getting errors when trying to build. I (perhaps stupidly) decided that this was probably due to the container having older versions of node and/or npm etc, so I attempted to update this by getting a bash shell into the container, installing nvm and updating node.js & npm.
This ended up with a rather broken container (node errors), so I thought I'd instead start again, but actually start with the jetbrains/minimal-build-agent Docker image instead, with the aim of ending up with a nice bespoke image for our needs specifically (as I couldn't find a very up-to-date pre-existing one)
I've running a Bash shell directly on the build agent container by executing this on the host:
docker exec -it basicagent /bin/bash
then from there I've installed nvm, Python (required for node install step) and node:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
apt-get update
apt-get install python 3.6
nvm install v8.11.1 (matching version on my dev machine)
npm install -g markdown-folder-to-html (npm package I previously found I had to install globally)
apt-get install zip (just used for a build step to zip up artifacts)
If I now run (via the bash shell) npm -version I get back 5.6.
If I try to get a build to run that uses npm in a command line step, then I get this error in the build log:
/opt/buildagent/temp/agentTmp/custom_script2764770419520852926: npm: not found
I wondered if it was an issue with the user/path that the team city agent process is using vs. the one I'm using in Bash, so I added the following to the build script:
echo PATH = $PATH
echo user var = $USER
echo user via 'id':
id -u -n
the output of which is:
PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
user var =
user via id:
root
So it's running the agent as root, and doesn't appear to have node in the $PATH at all.
If I run the above directly from Bash however, I can see that I am root, but my $PATH is different:
PATH = /root/.nvm/versions/node/v8.11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root
So I'm now confused: I've re-started the container and this has had no effect - it seems that when I'm logged in as root manually I have a certain path set, but when the build agent service is running as root it's different.
I have no idea why this happens, but I've basically worked around the problem by adding:
export PATH=$PATH:/root/.nvm/versions/node/v8.11.1/bin
to the top of every build step that uses npm in a script. To my mind this seems a rather daft thing to have to do - considering this used to work without this, and the only real difference is possibly a slightly different flavour of linux container. AFAIK the original build agent container was based on the jetbrains minimal-build-agent one, so unless they've changed what they base that on it should be roughly the same...
I also had to change the compressor being used in a node-minify build step from gcc (google closure compiler) to babel-minify as the former was basically hanging indefinitely, but that is a separate problem (though also something that was fine and now isn't...)
Thanks to anyone who took the time to read... though I do wonder if one-day I'll exhaust my own research options, and finally go ask the internet and actually get someone respond - for some reason whenever I get to the point where I have to ask, it always seems no-one else has the answer either and I end up having to work it out myself. It's probably character-building though I suppose.. (this isn't just SO - I've found this be the case for over 15 years on various forums about various things...)

Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine

I'm new to Play framework. Please explain the meaning of the below warning.
Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using node.js
I don't want anything that slow down my application so please advice if I should change the JS Engine to Node.js, but my PlayFramework project is using Java on the server side.
You need to install Node.js and then tell the sbt/java engine to use it.
brew install node
Edit .bash_profile and add:
export SBT_OPTS="${SBT_OPTS} -Dsbt.jse.engineType=Node -Dsbt.jse.command=$(which node)"
This eliminated the warning for me on OSX
In Windows:
Install node.js
Go to Control Panel - System and Security - System - Advanced system settings
Click Environment Variables...
Search in System variables for SBT_OPTS
If such exists, click Edit... and concatenate -Dsbt.jse.engineType=Node to Variable value
If such does NOT exist, click New... and write SBT_OPTS to Variable name and -Dsbt.jse.engineType=Node to Variable value
Click OK - OK - OK
Restart any command prompt (cmd, PowerShell) that is currently running Play Framework
in ubuntu
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
then add as above to your .profile in your home directory
export SBT_OPTS="${SBT_OPTS} -Dsbt.jse.engineType=Node -Dsbt.jse.command=$(which node)"
then
. ./.profile
to reload your .profile
For a more flexible install using node version manager check the following tutorial:
how to install node js on an ubuntu 14.04 server
Build again and the warning about using the Trireme stuff should be gone.
As an alternative to setting the environment variable, you can add this line to your build.sbt file:
JsEngineKeys.engineType := JsEngineKeys.EngineType.Node
See: https://github.com/sbt/sbt-js-engine
sbt plugins requiring a JS engine are used only in the build process, and so missing Node.js only slows down assets building stages if you use any.
The built application is not affected.
Anyway, you may want to install node.js to your PATH, where it should be auto-detected.
in Windows 10:
Install node.js from https://nodejs.org/en/
(The installer automatically adds node.js to your PATH)
then add:
export SBT_OPTS="$SBT_OPTS -Dsbt.jse.engineType=Node"
to your plugins.sbt in
. ./project/plugins.sbt
Worked for me - the warning has disappeared!
EDIT:
Apparently plugins.sbt was the wrong place to add the
export SBT_OPTS="$SBT_OPTS -Dsbt.jse.engineType=Node"
...although the warning disappeared when loading my app, it led to an error when relaunching the app a couple of hours later:
error: not found: value export
I would be glad if anyone could help and tell me where to put the export.

Install an ircbot that handles greetings of certain users

I want to greet a certain user ffki-besucher in a certain IRC channel.
Whenever that user logs in, it should get a special message written directly into the channel. I heard weechat is a good solution, but how can I achieve this?
How do I install weechat on debian wheezy?
I already installed some packages:
apt-get install weechat-curses weechat-plugins weechat-scripts perl
I use this cool guide at https://weechat.org/files/doc/stable/weechat_quickstart.en.html
Then I start weechat as user (not root):
weechat-curses
(in case you want to quit, use /quit)
Now I need the scripts, but I am stuck how to get this command running:
/script install buffers.pl
I also tried to load the script plugin again with
/plugin autoload script
The script plugin seems to be missing on debian! weechat in debian wheezy is quite old (0.3.8 which has a bug that the script plugin is not included in the debian package)
(I tried to install weechat from jessie, but that would give dependencie problems with some pelrl libs, that go down to the kernel)
Uninstall the repository packages with
apt-get remove weechat*
and install the new packages directly from the weechat download site which are version 1.0.1-1:
cd /tmp/
wget https://weechat.org/debian/dists/stable/main/binary-amd64/weechat-core_1.0.1-1_amd64.deb
wget https://weechat.org/debian/dists/stable/main/binary-amd64/weechat-curses_1.0.1-1_amd64.deb
wget https://weechat.org/debian/dists/stable/main/binary-amd64/weechat-plugins_1.0.1-1_amd64.deb
install guile:
aptget install guile-2.0-libs
then install the packages:
dpkg -i weechat-*
Now you can start weechat as user (not as root) and install the scripts:
/script install buffers.pl
/script install jnotify.pl
Connect to your server:
/server add oftc irc.oftc.net/6667
further set your connection like described here: https://weechat.org/files/doc/stable/weechat_quickstart.en.html#irc_server_options
some tips:
autocomplete with TAB or Shift-TAB
change buffer with Alt+1 or Alt+2,...
install beep.pl to send a notification through screen to your desktop (needs some configuration)
use /help jnotify to achieve the auto notifications to certain users, etc
Install irssi instead:
apt-get install irssi
su into your user and add the trigger.pl script. create:
mkdir -p ~/.irssi/scripts
cd ~/.irssi/scripts
git clone https://github.com/coekie/irssi-scripts/ coeki-irssi-scripts
ln -s coeki-irssi-scripts/trigger.pl
mkdir autorun
cd autorun
ln -s ../trigger.pl
Now start irssi as user
/connect irc.hackint.org
/join #ffki
/nick bot-rubo77
You can later edit your ~/.irssi/config file to autojoin your server and channel with a certain nick:
{ address = "irc.hackint.net"; chatnet = "hackint"; port = "6697"; use_ssl="yes"; autoconnect="yes"; },
...
chatnets = {
hackint = {
type = "IRC";
nick="bot-rubo77";
};
};
change to the status window (ESC 1) and create the trigger:
/trigger add -joins -channels "#ffki" -masks "*ffki-b*#*" -command "msg #ffki Hi $N! Please be patient! Not everyone is at the keyboard but you will be noticed in a few minutes ..."
/trigger save
some tips:
ESC 1 - switch to status window
ESC 2 - switch to window 2 (usually your first chat window) ...
/names shows all users in the channel
you can change the trigger in ~/.irssi/triggers and then type /trigger reload in the status window

Permission denied error while installing gitlab-ci

While installing gitlab ci (continues integration) on ubuntu (12.04LTS) i get the following error in step 5 (Setup application)
from: https://github.com/gitlabhq/gitlab-ci/blob/master/doc/installation.md
root#s2:~# cd /home/gitlab_ci/gitlab-ci/
root#s2:/home/gitlab_ci/gitlab-ci# sudo -u gitlab_ci -H gem install bundler
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/local/lib/ruby/gems/1.9.1 directory.
It seems these gems try to install outside /home/gitlab_ci which indeed would fail as user gitlab_ci
My question is - are these instructions wrong? - or - am i an edge case.
And offcourse how would I safely solve this problem, just running the command as root might give me more trouble later on...
Extra information, Ruby was originally installed for gitlab itself and that works fine.
Considering that gitlab installation step 2 proposes to recompile ruby, I usually compile it with a --prefix=/home/gitlab/ruby1.9.3 argument, in order to use a ruby in which I have full rights to write/add any gem I want without using sudo.
So the $PATH used by the gitlab_ci account should include /home/gitlab/ruby1.9.3/bin and any gem installed by that account would go into the local compiled ruby.
If both accounts are part of the same group, they should both be able to write into /home/gitlab/ruby1.9.3/lib/ruby/gems/1.9.1.

Resources