Nginx, MySQL, PHP automatic installation scripts

Source: Internet
Author: User
Tags fpm gpg mcrypt openssl snmp iptables

Before installing, please put the CD in the CD-ROM drive, if it is a virtual machine, please load two CD/DVD, CD/DVD2, and then upload the Nginx installation Pack WinSCP tool to Linux/usr/local/ Src. When the script is installed, it is repeatedly debugged, if the script content of Sys Init is placed inside, it will always error, so I do not add.

The script reads as follows:

vi/hoem/nginx_install.sh

Service Iptables Stop
Chkconfig iptables off
Setenforce 0

Mv/etc/yum.repos.d/rhel-debuginfo.repo/etc/yum.repos.d/rhel-debuginfo.repo.bak

Cat >/etc/yum.repos.d/rhel-debuginfo.repo <<eof
[Rhel-debuginfo]
name=red Hat Enterprise Linux $releasever-$basearch-debug
Baseurl=file:///mnt/cdrom/server
Enabled=1
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-redhat-release
Eof

Mkdir-pv/mnt/cdrom
Mount/dev/cdrom/mnt/cdrom

Yum List all

Yum Groupinstall "Development Tools"-y

Yum Groupinstall "Development Libraries"-y


Yum-y Groupinstall "X Software Development"


Yum-y Install NET-SNMP

Yum install gcc openssl-devel pcre-devel zlib-devel


Groupadd-r Nginx
Useradd-r-G Nginx

Cd/usr/local/src
Tar zxvf nginx-1.4.2.tar.gz
CD nginx-1.4.2
./configure \
--PREFIX=/USR \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/\
--http-proxy-temp-path=/var/tmp/nginx/proxy/\
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/\
--HTTP-UWSGI-TEMP-PATH=/VAR/TMP/NGINX/UWSGI \
--HTTP-SCGI-TEMP-PATH=/VAR/TMP/NGINX/SCGI \
--with-pcre
Make && make install


Mkdir/var/tmp/nginx/client-pv

Nginx

Now that the installation is complete, see if Nginx starts:

Netstat-an | More





############################################################################################################### #######################################################################



MySQL installation, installation is the generic binary package I used. The kind of direct decompression. Place the MySQL installation package in the/USR/LOCAL/SRC.

Service Iptables Stop
Chkconfig iptables off
Setenforce 0

Mv/etc/yum.repos.d/rhel-debuginfo.repo/etc/yum.repos.d/rhel-debuginfo.repo.bak

Cat >/etc/yum.repos.d/rhel-debuginfo.repo <<eof
[Rhel-debuginfo]
name=red Hat Enterprise Linux $releasever-$basearch-debug
Baseurl=file:///mnt/cdrom/server
Enabled=1
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-redhat-release
Eof

Mkdir-pv/mnt/cdrom
Mount/dev/cdrom/mnt/cdrom

Yum List all

Yum Groupinstall "Development Tools"-y

Yum Groupinstall "Development Libraries"-y

Yum-y Groupinstall "X Software Development"

Yum-y Install NET-SNMP

Yum install gcc openssl-devel pcre-devel zlib-devel

mkdir /mydata/data -PV
groupadd-r mysql
useradd-g mysql-r-s/sbin/nologin-m-d/mydata/data mysq L
Chown-r mysql:mysql/mydata/data
cd/usr/local/src
Tar zxvf mysql-5.5.39-linux2.6-i686.tar.gz-c/usr/ Local

cd/usr/local/
ln-sv mysql-5.5.39-linux2.6-i686      mysql

CD MySQL
chown-r mysql:mysql .
scripts/mysql_install_db--user=mysql--datadir=/mydata/data
chown-r root .

Cd/usr/local/mysql

CP support-files/mysql.server /etc/rc.d/init.d/mysqld
Chkconfig--add Mysqld
Chkconfig mysqld on

CP support-files/my-large.cnf /ETC/MY.CNF

echo "manpath /usr /local/mysql/man ">>/etc/man.config

ln-sv/usr/local/mysql/include /usr/include/mysql

echo '/usr/local/mysql/lib ' >/etc/ld.so.conf.d/mysql.conf
ldconfig

echo "/usr/local/mysql/bin" > >/etc/profile.d/mysql.sh
source /etc/profile

Cp/etc/my.cnf/etc/my.cnf.bak

Sed-i ' s#thread_concurrency = 8#thread_concurrency = 2#g '/etc/my.cnf

After the installation is complete, you need to do two things manually:

1. Cd/etc/my.cnf

DataDir =/mydata/data----loaded in [mysqld]

Thread_concurrency = 2----The value of the parameter is changed to the number of CPUs.



############################################################################################################### #######################################################################

PHP Installation: First put the following package on the/USR/LOCAL/SRC

libmcrypt-2.5.8-4.el5.centos.i386.rpm
libmcrypt-devel-2.5.8-4.el5.centos.i386.rpm
mcrypt-2.6.8-1.el4.i386.rpm
mhash-0.9.9-1.el5.centos.i386.rpm
mhash-devel-0.9.9-1.el5.centos.i386.rpm
Php-5.4.31.tar.gz
Xcache-3.1.0.tar.gz


Installation script:

Service Iptables Stop
Chkconfig iptables off
Setenforce 0

Mv/etc/yum.repos.d/rhel-debuginfo.repo/etc/yum.repos.d/rhel-debuginfo.repo.bak

Cat >/etc/yum.repos.d/rhel-debuginfo.repo <<eof
[Rhel-debuginfo]
name=red Hat Enterprise Linux $releasever-$basearch-debug
Baseurl=file:///mnt/cdrom/server
Enabled=1
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-redhat-release
Eof


Cd/usr/local/src
Yum-y Groupinstall "X Software Development"
Yum-y Install NET-SNMP
Tar XF php-5.4.31.tar.gz

#libmcrypt -2.5.8-4.el5.centos.i386.rpm
#libmcrypt-devel-2.5.8-4.el5.centos.i386.rpm
#mhash -0.9.9-1.el5.centos.i386.rpm
#mhash-devel-0.9.9-1.el5.centos.i386.rpm
#mcrypt -2.6.8-1.el5.i386.rpm

RPM-IVH *.rpm

CD php-5.4.31
./configure--prefix=/usr/local/php--with-openssl--enable-fpm--enable-sockets--enable-sysvshm--enable-mbstring- -with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib-dir--with-libxml-dir=/usr--enable-xml--with-mhash-- With-mcrypt--with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d--with-bz2--with-curl

Make
Make Test
Make install

CP SAPI/FPM/INIT.D.PHP-FPM/ETC/RC.D/INIT.D/PHP-FPM
chmod +x/etc/rc.d/init.d/php-fpm
Chkconfig--add PHP-FPM
Chkconfig PHP-FPM on

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

Sed-i ' #pm. Max_children = 5#pm.max_children = 150# '/usr/local/php/etc/php-fpm.conf

Sed-i ' #pm. start_servers = 2#pm.start_servers = 8# '/usr/local/php/etc/php-fpm.conf

Sed-i ' #pm. min_spare_servers = 1#pm.min_spare_servers = AA '/usr/local/php/etc/php-fpm.conf

Sed-i ' #pm. max_spare_servers = 3#pm.max_spare_servers = 10# '/usr/local/php/etc/php-fpm.conf

echo "pid =/usr/local/php/var/run/php-fpm.pid" >>/usr/local/php/etc/php-fpm.conf





This article is from the "Common Documents" blog, so be sure to keep this source http://yujianglei.blog.51cto.com/7215578/1562861

Nginx, MySQL, PHP automatic installation scripts

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.