环境:rhel6.5 172.25.40.1
一.源码编译mysql
1.安装依赖包例如cmake gcc gcc-c++ bison ncurses-devel
2.解压mysql,tar zxf
3.进入解压目录,cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
安装目录
-DMYSQL_DATADIR=/usr/local/mysql/data \
数据库存放目录
-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \ Unix socket 文件路径
-DWITH_MYISAM_STORAGE_ENGINE=1 \
安装 myisam 存储引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
安装 innodb 存储引擎
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
安装 archive 存储引擎
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
安装 blackhole 存储引擎
-DWITH_PARTITION_STORAGE_ENGINE=1 \
安装数据库分区
-DENABLED_LOCAL_INFILE=1 \
允许从本地导入数据
-DWITH_READLINE=1 \
快捷键功能
-DWITH_SSL=yes \
支持 SSL
-DDEFAULT_CHARSET=utf8 \
使用 utf8 字符
-DDEFAULT_COLLATION=utf8_general_ci \
校验字符
-DEXTRA_CHARSETS=all \
安装所有扩展字符集
-DMYSQL_TCP_PORT=3306 \
MySQL 监听端口
4.make && make install
5.添加启动脚本cp /usr/local/lnmp/mysql/support-files/mysql.server /etc/init.d/mysqld
6.修改配置文件cp /etc/my.cnf /etc/my.cnf.bak
cp /usr/local/lnmp/mysql/support-files/my-default.nf /etc/my.cnf
进入配置文件修改basedir datadir socket
7.创建mysql用户(uid=27 gid=27)
8.写入path/usr/local/lnmp/mysql/bin
~/.bash_profile ----- :/usr/local/lnmp/mysql/bin ------ source ~/.bash_profile
9.初始化数据库得到初始密码,然后修改密码初始化:mysqld --user=mysql --initialize
修改密码:mysql_secure_installation
二.源码编译php
1.安装依赖net-snmp-develcurl-devellibxml2-devellibpng-devellibjpeg-develfreetype-develgmp-developenldap-devel
re2c-0.13.5-1.el6.x86_64.rpm
libjpeg-turbo-devel-1.2.1-1.el6.x86_64
libmcrypt-*
2.进入解压目录./configure --prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp --with-gettext --with-pear --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --enable-fpm --enable-mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash
3.make && make install
4.创建nginx用户
5.修改php的pid指向/usr/local/lnmp/php/etc cp php-fpm.conf.default php-fpm.conf
pid = run/php-fpm.pid
6.脚本运行解压目录下/sapi/fpm/init.d.php-fpm
cp init.d.php-fpm /etc/init.d/php-fpm(加权限)
7.主配置文件的修改解压目录下/
cp php.ini-production /usr/local/lnmp/php/etc/php.ini
修改timezone:Asia/Shanghai
8.启动
三.nginx源码安装
1.依赖包pcre-devel
2.解压 tar zxf
3.进入解压目录,./configure --prefix=/usr/local/lnmp/nginx --with-http_ssl_module --with-http_stub_status_module --with-threads --with-file-aio --user=nginx --group=nginx
4.make && make install
5.修改配置文件 添加.php文件的解析/usr/local/lnmp/nginx/conf/nginx.conf
location / {
root html;
index index.html index.htm index.php;
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
6.做软连接ln -s /usr/local/lnmp/nginx/sbin/nginx /usr/local/sbin/
7.验证php的发布/usr/local/lnmp/nginx/html/index.php
phpinfo
?>
172.25.40.1/inde.php即可查看
四.论坛的安装
1.unzip工具解压yum install -y unzip
2.解压到nginx发布目录unzip Discuz_X3.2_SC_UTF8.zip -d /usr/local/lnmp/nginx/html/
3.解压后update文件中的部分文件给予权限chmod 777 config/ -R
chmod 777 data/ -R
chmod 777 uc_client uc_server -R
4.修改php中数据库的指向vim php.ini
mysql.default_socket = /usr/local/lnmp/mysql/data/mysql.sock
5.给予数据库data目录的权限chmod 755 /usr/local/lnmp/mysql/data/
6.重启各服务,172.25.40.1/update/install/即可安装