How to install Swoole in ubuntu - swoole

Simply my Question is How to Install Swoole in Ubuntu 14.04 LTS
I have tried
sudo pecl install swoole
am getting handfull of errors, already posted here
Is there any alternate way to install the same...

Swoole Installation alternate ways
1.Install from source
sudo apt-get install php7-dev
git clone https://github.com/swoole/swoole-src.git
cd swoole-src
phpize
./configure
make && make install
2.Example for static compile
git clone -b PHP-7.2 --depth 1 https://github.com/php/php-src.git
cd php-src/
git clone -b master --depth 1 https://github.com/swoole/swoole-src.git ext/swoole
./buildconf --force
./configure --prefix=/usr/local/php7 --disable-all --enable-cli --disable-cgi --disable-fpm --disable-phpdbg --enable-bcmath --enable-hash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --enable-sockets --enable-pdo --with-sodium --with-password-argon2 --with-sqlite3 --with-pdo-sqlite --with-pcre-regex --with-zlib --with-openssl-dir --enable-swoole-static --enable-openssl --with-swoole
time make -j `cat /proc/cpuinfo | grep processor | wc -l`
sudo make install

Some Linux distributions do not include the PHP-XML extension in their PHP package and will need to be enabled before using PECL. You can install using apt-get install php-xml and you may need to install PHPize to compile Swoole, you can install it using apt-get install php7.*-dev or whatever PHP version you are using.
Then try again with sudo pecl install swoole

For those who installed PHP from ondrej/php PPA (quite common way to install PHP in Ubuntu) it's quite easy now:
sudo apt install php-swoole
Or for specific version:
sudo apt install php7.4-swoole
Tip. This is how you usually install ondrej/php PPA:
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

Install swoole for version specific should work for example if you have php 7.3 use
sudo apt install php7.3-swoole
replace the version to your local php env

Related

How to install python3.6 on Ubuntu 22.04

I need to install this specific python version, to prepare a developer environment, because I'm maintaining a system with multiple libraries based on python 3.6.9.
I recently installed Ubuntu 22.04 on my laptop, but I had no success trying to install this python version.
I tried to install with apt-get after adding the deadsneak repository, but this python version is not available.
I tried installing from source by compiling, but it did not work. Running sudo make altinstall exited with this error:
Segmentation fault (core dumped)
make: *** [Makefile:1112: altinstall] Erro 139
I have faced the same problems and could make it work by adding some additional flags when running ./configure
Here are my steps:
Step 1 – Prerequsities
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev \
libgdbm-dev libnss3-dev libedit-dev libc6-dev
Step 2 – Download Python 3.6
wget https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz
tar -xzf Python-3.6.15.tgz
Step 3 – Compile Python Source
cd Python-3.6.15
./configure --enable-optimizations -with-lto --with-pydebug
make -j 8 # adjust for number of your CPU cores
sudo make altinstall
Step 4 – Check the Python Version
python3.6 -V
If you need it to install with pyenv, you could try this one:
$ sudo apt install clang -y
$ CC=clang pyenv install 3.6.9

Installing R devtools package on WSL

The problem:
I'm trying to install the devtools package for R. I'm using Ubuntu 18.04 LTS on WSL, the Windows Subsystem for Linux.
I'm able to install some packages just fine with a simple call to install.packages() from within R on WSL. However, other packages seem to give me trouble.
None of the following methods I've tried seem to work:
* I've tried installing the package with install.packages().
* I've tried installing from source into /usr/local/lib/R/site-library.
* I've tried installing from source into a personal library.
Error message:
I was recieving an error message like that discussed here, but I was unable to fix the problem by editing unpackPkgZip because it didn't exist.
The Question:
How can I install devtools on WSL?
Solution:
I was able to fix the problem by starting over. I uninstalled Ubuntu and then reinstalled it. With a fresh install of Ubuntu 18.04 I followed these instructions. There are other online tutorials which probably work just fine, but I followed this one. You can ignore the bit about installing an rstudio server and the fsl package if you wish.
# Install R on WSL
sudo apt-get update -qq -y
sudo apt-get install -y wget git
OS_DISTRIBUTION=$(lsb_release -cs)
wget -O- http://neuro.debian.net/lists/${OS_DISTRIBUTION}.us-nh.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
sudo apt-get update
sudo apt-get install libopenblas-base r-base
sudo apt-get update -qq -y
sudo apt-get install -y libgit2-dev
sudo apt-get install -y libcurl4-openssl-dev libssl-dev
sudo apt-get install -y zlib1g-dev libssh2-1-dev libpq-dev libxml2-dev
#sudo apt-get install -y libhdf5 # This didn't work.
Now try installing devtools in R.
# Install devtools
install.packages("devtools", repos = "https://cran.rstudio.com/")
Permission error:
If you encounter a permission error like the following...
Warning in install.packages("edgeR") :'lib = "/usr/local/lib/R/site-library"' is not writable Would you like to use a personal library instead? (y/n)
...you need to provide the user with write access to the directory where R packages are installed (see here). Try changing the group ownership of this directory:
# Who has ownership of /usr/local/lib/R/site-library/?
ls -l /usr/local/lib/R/
# drwxrwsr-x 1 root staff 512 Jul 18 21:38 site-library
# Change ownership.
sudo chgrp twesleyb /usr/local/lib/R/site-library/
ls -l /usr/local/lib/R/
#drwxrwxr-x 1 root twesleyb 512 Jul 18 21:38 site-library
# In this case I have write access, but in case you need to add it, try:
# $ sudo chmod g+w /usr/local/lib/R/site-library
You should now be able to install.packages("package").
I'm a linux novice, but I think this is an okay thing to do.
Update:
You can also try following duckmayr's instructions.

Issue installing Virtualenvwrapper on Ubuntu 18.04?

Fresh Ubuntu 18.04 install. Following these instructions here are the commands I've run so far.
sudo apt update
sudo apt upgrade
python3 -V
sudo apt install python3-pip
sudo apt install build-essential libssl-dev libffi-dev python3-dev
sudo apt install python3-venv
source /usr/local/bin/virtualenvwrapper.sh
Returns
bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory.
find virtualenvwrapper.sh
Returns
find: ‘virtualenvwrapper.sh’: No such file or directory
EDIT:
Sudo -H pip3 install virtualenv virtualenvwrapper
didn't solve the issue either.
I found this solution that sovled the issue.
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
then make sure to install virtualenv and virtualenvwrapper with:
sudo /usr/local/bin/pip3 install virtualenv virtualenvwrapper
You may have to use sudo's -H flag like I did for it to work.
on Ubuntu 18.04 I had to add this to my .bash_profile
# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenv
export VIRTUALENVWRAPPER_LOG_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh
Then run source ~/.bash_profile
You've installed python3, pip and venv but not virtualenvwrapper. Install it with pip:
pip install virtualenvwrapper
This is what worked for me:
Purge and reinstall pip first.
sudo apt-get purge python-pip
sudo apt-get update
sudo apt-get install python-pip
Then install virtualenvwrapper:
sudo pip install virtualenvwrapper

Make apt install packages from a specific repository

Is there any way to have apt install a package from a specific launchpad repository?
I would like to set up a little test server and install all of the 1000+ r-cran-* packages from the cran2deb4ubuntu launchpad repository. As of last month, all packages in this repository are build for R 3.0.1. So I install a copy of R 3.0.1 and then do:
sudo add-apt-repository marutter/c2d4u
sudo apt-get update
sudo apt-get install r-cran-*
However, this will also install all of the r-cran-* packages form universe which are build for R 2.15, and hence will fail to load. Is there an easy way to install the packages only from c2d4u? Or alternatively, is there a way to blacklist the r-cran- packages in universe from apt?
What I ended up doing is simply install all packages and then remove the ones with an old build. I.e.
sudo add-apt-repository ppa:marutter/c2d4u -y
sudo add-apt-repository ppa:marutter/rrutter -y
sudo apt-get update
sudo apt-get install r-bioc-*
sudo apt-get install r-cran-
And then in R:
which(installed.packages()[,"Built"] < 3.0)

error: --with-readline=yes (default) and headers/libs are not available

I am installing R. I am getting this error when runing ./configure :
checking for history_truncate_file... no
configure: error: --with-readline=yes (default) and headers/libs are not available
Any hint,
Thanks
Use the following command will solve this problem
./configure --with-readline=no --with-x=no
--with-x=no turns off the X Windows System . It is the GUI for the Linux and Unix-like OS. My computer has no X Windows installed, so I turn off.
But I highly recommand to install readline library before R installtion with '--with-readline=yes', as the command operation style is quitely unfriendly with '--with-readline=no' . See more libreadline installation in linux for more details
you can use the following command for more install configuration details
./configure --help
on I found problem on compiling R 3.1.1 so as a part of solution , i recommend to install the below libraries first before you compile this R and use
sudo apt-get install build-essential
sudo apt-get install fort77
sudo apt-get install xorg-dev
sudo apt-get install liblzma-dev libblas-dev gfortran
sudo apt-get install gcc-multilib
sudo apt-get install gobjc++
sudo apt-get install aptitude
sudo aptitude install libreadline-dev
Thank you other people who posted and kept the knowledge going..
I think you need the GNU readline package. You can install it with apt-get, aptitude, or the appropiate tool for your distribution. In Ubuntu:
aptitude install libreadline-dev
On Linux version 2.6.18-371.3.1.el5 (centos) the following worked for me
yum install readline-devel
and use --with-x=no in configure option as mentioned by others
I added this in the file taken here:
http://www.personal.psu.edu/mar36/blogs/the_ubuntu_r_blog/2012/08/installing-the-development-version-of-r-on-ubuntu-alongside-the-current-version-of-r.html
CXXFLAGS="-ggdb -pipe -Wall -pedantic -I/usr/include/readline5" \
CPPFLAGS="-I/usr/include/readline5" \
LDFLAGS="-L/usr/lib64/readline5" \
On Centos 7, building R-3.5.0, If you want to install in /data/R-3.0.5.
wget https://www.stats.bris.ac.uk/R/src/base/R-3/R-3.5.0.tar.gz
tar -zxvf R-3.5.0.tar.gz
cd R-3.5.0.tar.gz
mkdir -p /data/R-3.0.5
yum group install "Development tools" -y
yum install readline-devel -y
yum install xorg-x11-server-devel libX11-devel libXt-devel -y
yum yum install libbz2-devel -y
yum install lzma -y
yum install xz xz-devel -y
yum install pcre pcre-devel -y
yum install libcurl-devel -y
yum install texinfo -y
yum install texinfo-tex -y
yum install texlive -y
yum install texlive-fonts-extra -y
yum install levien-inconsolata-fonts -y
yum install java-1.8.0-openjdk -y
./configure --prefix=/data/R-3.0.5 '--with-cairo' \
'--with-jpeglib' '--with-readline' '--with-tcltk' \
'--with-blas' '--with-lapack' '--enable-R-profiling' \
'--enable-R-shlib' \
'--enable-memory-profiling'
make
make install
The error means your system cannot find the required package. On Ubuntu, you can refer to this document to install all missing dependencies. It works for R 4.0
https://github.com/Jiefei-Wang/Painless-R-compilation-and-installation-on-Ubuntu

Resources