今日学习记录:LNMP源码安装
- 安装编译工具及库文件
yum install -y apr autoconf automake bison bzip2 bzip2 compat cpp curl curl-devel fontconfig fontconfig-devel freetype freetype freetype-devel gcc gcc-c++ gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg libsepol-devel libselinux-devel libstdc++-devel libtool libgomp libxml2 libxml2-devel libXpm libtiff libtiff make mpfr ncurses ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib nasm nasm* wget zlib-devel
1.1安装cmake编译工具
cd /usr/local/src
ls
tar xzvf cmake-2.8.11.2.tar.gz
cd cmake-2.8.11.2/
./configure
make
make install - 配置Mysql服务
2.1创建用于执行mysql服务程序的帐号:
cd ..
useradd mysql -s /sbin/nologin
2.2创建数据库程序和文件的目录,并设置目录的所属与所组:
mkdir -p /usr/local/mysql/var
chown -Rf mysql:mysql /usr/local/mysql
2.3安装Mysql服务程序
tar xzvf mysql-5.6.19.tar.gz
cd mysql-5.6.19/
cmake.DCMAKE_INSTALL_PREFIX=/usr/local/mysqlDMYSQL_DATADIR=/usr/local/mysql/var-DSYSCONFDIR=/etc
make
make install
2.4删除系统默认的配置 文件:
rm -rf /etc/my.cnf
2.5生成系统数据库
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var
2.6创建配置文件的软连接文件:
ln -s my.cnf /etc/my.cnf
2.7将mysqld服务程序添加到开机启动项:
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig mysqld on
2.8编辑启动项的配置文件:
vim /etc/rc.d/init.d/mysqld
//分别修改第46与47行,basedir为程序安装路径,datadir为数据库存放目录。
basedir=/usr/local/mysql
datadir=/usr/local/mysql/var
2.9重启mysqld服务程序:
service mysqld start
2.10把mysql服务程序命令目录添加到环境变量中(永久生效):
vim /etc/profile
//在配置文件的最下面追加:
export PATH=$PATH:/usr/local/mysql/bin
3 安装PCRE
cd /usr/local/src
mkdir /usr/local/pcre
tar xzvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make
make install
3.1安装openssl服务程序
cd /usr/local/src
mkdir /usr/local/openssl
tar xzvf openssl-1.0.1h.tar.gz
cd openssl-1.0.1h
./config --prefix=/usr/local/openssl
make
make install
3.2把openssl服务程序命令目录添加到环境变量中(永久生效):
vim /etc/profile
//将配置文件最下面的参数追加参数为:
export PATH=$PATH:/usr/local/mysql/bin:/usr/local/openssl/bin
source /etc/profile
3.3安装zlib数据压缩函数库
cd /usr/local/src
mkdir /usr/local/zlib
tar xzvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib
make
make install
3.4创建用于执行nginx服务的用户:
tar xzvf nginx-1.6.0.tar.gz
cd nginx-1.6.0/
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.0.1h --with-zlib=/usr/local/src/zlib-1.2.8 --with-pcre=/usr/local/src/pcre-8.35
make
make install
3.5创建nginx程序脚本
vim /etc/rc.d/init.d/nginx
chmod 755 /etc/rc.d/init.d/nginx
3.6重启nginx服务程序并添加到开机启动项:
/etc/rc.d/init.d/nginx restart
Restarting nginx (via systemctl): [ OK ]
chkconfig nginx on
原文地址:http://blog.51cto.com/13956297/2176324