Linux Basic Learning compilation installation Php+mysql+python3+memcached+radis+rabbitmq+libevent+tcl+gcc+erlang

Source: Internet
Author: User
Tags chmod curl fpm memcached rabbitmq

CentOS 6.9 Compile and install Nginx+php+mysql


0X01 Environment constraints

Source Location/home/[User folder]

Source compilation installation location/usr/local/[software name]

CentOS6.9 x86-64 Minimized installation Configure network users to log on using Xshell


0x02 software Download


Intranet Address:

Http://192.168.20.252/src/php.tar.gz

Http://192.168.20.252/src/cmake.tar.gz

Http://192.168.20.252/src/libmcrypt.tar.gz

Http://192.168.20.252/src/mysql.tar.gz

Http://192.168.20.252/src/nginx.tar.gz

Http://192.168.20.252/src/pcre.tar.gz


0X03 Pre-Installation Preparation

Using a user login host

Su #将当前用户提升至root权限


Yum update-y # Install the latest patches on your current operating system to make sure the system is up to date

#以下是安装依赖组件, compiling tools, library files

Yum install-y make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel OpenSSL openssl-devel pcre-devel gd kernel ke Yutils Patch perl kernel-headers compat* MPFR CPP glibc LIBG

OMP libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel libxpm* freetype lib libpng libpng-devel libxml2-devel wget screen cyrus-sasl-devel.x86_64

0X04 installation CMake


Tar zxvf cmake.tar.gz

CD Cmake-[tab]

./configure && make && make install


0x05 installing MySQL


Groupadd MySQL #添加mysql用户组

Useradd-s/sbin/nologin-g mysql-r MySQL #创建用户 MySQL and joins to the MySQL user group and does not allow MySQL users to log in directly to the system

Mkdir-p/data/mysql #创建MySQL数据库文件存放目录

Chown-r Mysql:mysql/data/mysql #设置权限

Tar zxvf mysql.tar.gz

CD mysql-

CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql/-dsysconfdir=/etc #编译器编译前配置检查

Make && make install #编译和安装

Cd/usr/local/mysql

CP./SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF #拷贝配置文件

Vi/etc/my.cnf #编辑配置文件 added in the [mysqld] section

DataDir =/data/mysql #添加mysql数据库路径

./scripts/mysql_install_db--user=mysql #生成mysql系统数据库

CP./SUPPORT-FILES/MYSQL.SERVER/ETC/RC.D/INIT.D/MYSQLD #把mysql加入到系统服务

chmod 755/etc/init.d/mysqld #增加执行权限

Chkconfig mysqld on #开机启动该服务

Vi/etc/rc.d/init.d/mysqld #编辑服务启动脚本

Basedir =/usr/local/mysql

DataDir =/data/mysql



Service mysqld Start #启动mysql服务

Vi/etc/profile #编辑系统环境变量 Add the following environment variable at the end

Export PATH = $PATH:/usr/local/mysql/bin


Source/etc/profile #系统环境变量生效

#下面把mysql的库文件添加到系统的默认位置中, so that when compiling PHP, you do not have to make the MySQL library file address

Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql

Ln-s/usr/local/mysql/include/mysql/usr/include/mysql


Reboot #第一次重启


mysql_secure_installation #设置MySQL的 Root User password

Service mysqld Restart #重启mysql服务


0X06 Mounting Pcre


Tar zxvf pcre.tar.gz

CD pcre-

./configure--prefix=/usr/local/pcre && make && make install


0x07 Installing Nginx


Groupadd www

Useradd-s/sbin/nologin-g Www-r www

Tar zxvf nginx.tar.gz

CD nginx-

./configure--prefix=/usr/local/nginx--without-http_memcached_module--user=www--group=www--with-http_stub_ Status_module--with-openssl=/usr/--with-pcre=/home/jue/pcre-8.41/

Make && make install



Vi/etc/init.d/nginx

[Copy nginx startup script]



chmod 775/etc/rc.d/init.d/nginx #设置运行权限

Chkconfig Nginx on

/etc/rc.d/init.d/nginx Restart #重启nginx just to test

Service Nginx Restart #重启nginx服务



0x08 Installation Libmcrypt

Tar zxvf libmcrypt.tar.gz

CD libmcrypt-

./configure && make && make install


0x09 Installing PHP


Tar zxvf php.tar.gz

CD php-

Mkdir-p/usr/local/php

./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql-- With-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/mysql.sock--with-gd--with-iconv--with-zlib --enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curlwrappers-- Enable-mbregex--enable-fpm--enable-mbstring--enable-ftp--enable-gd-native-ttf--with-openssl--enable-pcntl-- Enable-sockets--with-xmlrpc--enable-zip--enable-soap--with-pear--with-gettext--enable-session--with-mcrypt-- With-curl

Make && make install

CP Php.ini-production/usr/local/php/etc/php.ini

Rm-rf/etc/php.ini

Ln-s/usr/local/php/etc/php.ini/etc/php.ini

Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

vi/usr/local/php/etc/php-fpm.conf #在这个文件中设置 3 Items

user = www

Group = www

PID = Run/php-fpm.pid #去掉了前面的分号



cp/home/feng/php-5.6.31/sapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm

chmod 755/etc/rc.d/init.d/php-fpm

Chkconfig PHP-FPM on

Vi/etc/php.ini

Data.timezone = RPC #设置时区



0x10 Configuring Nginx Support PHP

Mkdir-p/home/wwwroot

Chown-r Www:www/home/wwwroot

Vi/usr/local/nginx/conf/nginx.conf

User www www;


Root/home/wwwroot #web根目录

Index index.php index.html index.htm; #添加index. php


Location ~ \.php$ {

Root/home/wwwroot;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

Include Fastcgi_params;

}







/etc/init.d/nginx restart


0x11 Test


Cd/home/wwwroot

VI index.php

<?php phpinfo ();? >



Chown-r Www:www/home/wwwroot

Curl HTTP://127.0.0.1/

Curl http://localhost/



Configure Python3

# wget http://192.168.40.66/python3.tar.gz

TAR-ZXVF python3.tar.gz

CD PYTHON-3.6.2/

./configure--prefix=/usr/local/python3 && make && make install

Ln-s/usr/local/python3/bin/python3.6/usr/bin/python3

Cd/home/ht



Configuring Libevent and Memcached


wget http://192.168.100.252/src/libevent.tar.gz

wget http://192.168.100.252/src/memcached.tar.gz

102 TAR-ZXVF Libevent.tar.gz

103 CD libevent-2.1.8-stable/

104./configure--prefix=/usr/local/libevent

&& make Install

106 CD.


108 TAR-ZXVF memcached.tar.gz

109 CD memcached-1.5.0/

111./configure--prefix=/usr/local/memcached--ENABLE-SASL--with-libevent=/usr/local/libevent && Make & & Make Install

Cd/usr/local/python3/bin

./pip3.6 Install python3-memcached




Configuring GCC

209 wget http://192.168.100.252/src/gcc.tar.gz

TAR-ZXVF gcc.tar.gz

211 MkDir Gccmake

213 CD gcc-4.9.4/

214 Vi./contrib/download_prerequisites

wget http://192.168.100.252/src/gcc/$MPFR. tar.bz2 | | Exit 1 (config file, change URL)

215./contrib/download_prerequisites

216 CD.

CD Gccmake

221.. /gcc-4.9.4/configure--enable-checking=release--enable-languages=c,c++--disable-multilib

223 Make && make install

Configure Redis

Cd/home/ht

224 wget http://192.168.100.252/src/tcl.tar.gz

225 wget http://192.168.100.252/src/redis.tar.gz

232 TAR-ZXVF tcl.tar.gz

234 CD tcl8.6.6/

236 Cd/home/ht

237 RM-RF/USR/LIB64/LIBSTDC

239 cp/home/ht/soft/gccmake/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so/usr/lib64/libstdc++.so .

Rm-rf/usr/lib64/libstdc++.so.6

241 ln-sv/usr/lib64/libstdc++.so/usr/lib64/libstdc++.so.6

242 gcc-v

243 Cd/home/ht

246 CD tcl8.6.6/

247 CD Unix

./configure

252 make install && make Install-private-headers

253 CD.

255 TAR-ZXVF redis.tar.gz

257 CD redis-3.2.10/

258 Make Prefix=/usr/local/redis Install

259 cd/usr/local/redis/

260 mkdir conf

261 cd/home/jue/

263 CD redis-3.2.10/

265 CP redis.conf/usr/local/redis/conf

266 CD.

268 ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql

269 ln-s/usr/local/mysql/include/mysql/usr/include/mysql

288./pip3.6 Install Python-redis (under/usr/local/python3/bin)



Configure Erlang

394 Cd/home/ht

395 ls

396 mkdir Rabbit

CD Rabbit

399 wget HTTP://192.168.100.252/SRC/RABBITMQ.TAR.XZ

wget http://192.168.100.252/src/otp.tar.gz

401 Yum Install kernel-devel M4 ncurses-devel Openssl-devel

408 tar-zxvf otp.tar.gz

411 CD otp_src_20.0/

412./configure--prefix=/usr/local/erlang--with-ssl--enable-threads--enable-smmp-support--enable-kernel-poll-- Enable-hipe--without-javac

416 Make && make install



Configure Rabbit


Cd/usr/bin

452 RM-RF python Python2

453 LL python*

455 vim Yum

470 Cd/usr/bin

471 Ln-sv/usr/local/python3/bin/python3.6/usr/bin/python

484 wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-6.repo (Inspection situation) (Yum source)

485 yum Makecache (yum cache)

525 Vi/etc/profile

526 Source/etc/profile

CD Rabbit

442 TAR-XVF RABBITMQ.TAR.XZ

534 CD rabbitmq-server-3.6.10/

537 Yum Install zip rsync libxslt-y

538 Make PREFIX=/USR/LOCAL/RABBITMQ Install

Make && make install

539 Cd/usr/local/python3/bin

541./pip3.6 Install Simplejson




Linux Basic Learning compilation installation Php+mysql+python3+memcached+radis+rabbitmq+libevent+tcl+gcc+erlang

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.