阿里云lnmp MariaDB10 php5.6 nginx1.9

lrenwang , 2015/07/26 17:14 , Linux , 评论(0) , 阅读(2272) , Via 本站原创 | |
安装环境 centos6.3(64位) php5.4.22 mysql5.6 nginx1.5.7

vim复制自动注释解决办法
echo 'set paste' >> /etc/vimrc


注意安装mysql5.6以上需要大内存


一挂载数据盘
执行“fdisk -S 56 /dev/xvdb”命令,对数据盘进行分区;
根据提示,依次输入“n”,“p”“1”,两次回车,“wq”,分区就开始了,很快就会完成。
使用“fdisk -l”命令可以看到,新的分区xvdb1已经建立完成了。
使用“mkfs.ext3 /dev/xvdb1”命令对新分区进行格式化,格式化的时间根据硬盘大小有所不同。
使用“echo '/dev/xvdb1  /data ext3    defaults    0  0' >> /etc/fstab”(不含引号)命令写入新分区信息。
然后使用“cat /etc/fstab”命令查看,出现以下信息就表示写入成功。
mkdir /data
使用“mount -a”命令挂载新分区,然后用“df -h”命令查看,出现以下信息就说明挂载成功,可以开始使用新的分区了。

二cp 命令直接覆盖,不需要提示

sed -i "s/alias cp='cp -i'/#alias cp='cp -i'/g" ~/.bashrc
su -

三更新所需的安装包

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers vsftpd patch zip unzip vim wget ncurses-devel   bison bison-deve    cmake readline-devel zlib-devel  boost


四软件下载

mkdir /data/soft/config -p
cd /data/soft
wget http://blog.lrenwang.com/down/lnmp/nginx-1.9.2.tar.gz
wget http://blog.lrenwang.com/down/lnmp/php-5.6.9.tar.gz
wget http://blog.lrenwang.com/down/lnmp/libiconv-1.13.tar.gz
wget http://blog.lrenwang.com/down/lnmp/libmcrypt-2.5.8.tar.gz
wget http://blog.lrenwang.com/down/lnmp/mcrypt-2.6.8.tar.gz
wget http://blog.lrenwang.com/down/lnmp/memcache-2.2.7.tgz
wget http://blog.lrenwang.com/down/lnmp/mhash-0.9.9.9.tar.gz
wget http://blog.lrenwang.com/down/lnmp/pcre-8.33.zip
wget http://blog.lrenwang.com/down/lnmp/PDO_MYSQL-1.0.2.tgz
cd /data/soft/config
wget http://blog.lrenwang.com/down/lnmp/config/php.ini
wget http://blog.lrenwang.com/down/lnmp/config/my.cnf
wget http://blog.lrenwang.com/down/lnmp/config/php-fpm.conf
wget http://blog.lrenwang.com/down/lnmp/config/nginx.conf
wget http://blog.lrenwang.com/down/lnmp/config/fcgi.conf

五安装php mysql


#1、编译安装PHP所需的支持库:

tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13/
./configure --prefix=/usr/local
make
make install
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../



#2、编译安装mysql


vim /etc/yum.repos.d/MariaDB.repo

内容为

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

安装数据库


yum install -y MariaDB MariaDB-client MariaDB-server MariaDB-devel
/usr/bin/mysql_install_db  --datadir=/data/mysql/data --user=mysql
cp config/my.cnf  /etc/my.cnf
service mysql start
/usr/bin/mysqladmin -uroot password "123456" -p


#3、编译安装PHP

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
ln -s /usr/lib64/lib* /usr/lib/
tar zxvf php-5.6.9.tar.gz
cd  php-5.6.9

./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc   --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex  --enable-fpm  --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear  --with-fpm-user=www --with-fpm-group=www -disable-fileinfo --with-mysql  --with-mysqli
make ZEND_EXTRA_LIBS='-liconv'
make install
cp  sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
chkconfig php-fpm on
cp /usr/local/webserver/php/etc/php-fpm.conf.default /usr/local/webserver/php/etc/php-fpm.conf
cp php.ini-production /usr/local/webserver/php/etc/php.ini
cd ../

/usr/sbin/groupadd www
/usr/sbin/useradd -g www www

service php-fpm start

# 设置 /usr/local/webserver/php/etc/php-fpm.conf   /usr/local/webserver/php/etc/php.ini相关信息
六安装Nginx

unzip pcre-8.33.zip
cd pcre-8.33/
./configure
make && make install
cd ../
ln -s /usr/local/lib/libpcre.so.1 /lib/
ln -s /lib/libpcre.so.1 /lib64/
#2、安装Nginx
tar zxvf nginx-1.9.2.tar.gz
cd nginx-1.9.2/
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../


2创建Nginx日志目录

mkdir -p /data/logs
chmod +w /data/logs
chown -R www:www /data/logs

3创建Nginx配置文件

cp config/nginx.conf /usr/local/webserver/nginx/conf/nginx.conf
cp config/fcgi.conf /usr/local/webserver/nginx/conf/fcgi.conf


4启动Nginx

ulimit -SHn 65535
/usr/local/webserver/nginx/sbin/nginx

5配置开机自动启动

echo "ulimit -SHn 65535" >> /etc/rc.d/rc.local
echo "/usr/local/webserver/nginx/sbin/nginx"  >>  /etc/rc.d/rc.local
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]