资源:
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.24.tar.gz
wget http://cn2.php.net/distributions/php-5.6.8.tar.bz2
wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz
wget http://mirrors.hust.edu.cn/gnu/automake/automake-1.11.5.tar.gz
安装起始:
yum update
reboot
yum install screen wget iptraf unzip subversion man setuptool system-config-firewall-tui system-config-network-tui ntsysv vim links bzip2 net-tools
yum install gcc-c++ pcre-devel zlib-devel make autoconf
yum install memcached-devel libmemcached-devel
yum install samba samba-common samba-client
一、安装mysql
删除系统中已存在的MySQL
1.执行yum命令,删除MySQL的lib库,服务文件
yum remove mysql mysql-server mysql-libs mysql-server
2.执行find命令,查找MySQL的残留文件
find / -name mysql
3.如果存在残留文件,将其删除。
rm -rf *mysql*
删除系统中已存在的MySQL安装包
1.查找是否有mysql安装包
rpm -qa | grep -i mysql
2.如果有,则删除安装包
yum -y remove mysql-libs*
安装新版本mysql
1.首先添加依赖应用
yum install -y gcc gcc-c++ autoconf automake zlib* libxml* libtool-ltdl-devel*
2.安装 cmake 及相关软件 ncurses 和 bison
cd /usr/local/src
wget http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz
tar zxvf cmake-3.0.2.tar.gz
cd cmake-3.0.2
./bootstrap
make && make install
yum install -y ncurses-devel*
yum install -y bison
3.创建 mysql 用户, 创建数据库目录和权限
groupadd mysql
useradd -g mysql mysql
mkdir -p /data/mysql
chown -R root:mysql /data/mysql
4.下载 mysql 源码并且编译 (源码包用最新的)
cd /usr/local/src
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.24.tar.gz
tar xzfv mysql-x.x.xx.tar.gz
cd mysql-xx.xx.xx
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATE_STORAGE_ENGINE=1
gmake
gmake install
5.配置 mysql
cd /usr/local/mysql
cp ./support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf
在 [mysqld] 段增加
datadir = /data/mysql
wait-timeout = 30
max_connections = 512
max_connect_errors = 10000000
default-storage-engine = MyISAM
在 [mysqld] 段修改
max_allowed_packet = 16M
然后保存退出编辑
初始化数据库
./scripts/mysql_install_db --datadir=/data/mysql --basedir=/usr/local/mysql --defaults-file=/etc/my.cnf --user=mysql
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
设置启动脚本变量
编辑 /etc/rc.d/init.d/mysqld
vim /etc/rc.d/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
设置变量环境
#echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile (永久生效)
cd bin
启动服务
service mysqld start
设置数据库管理员root密码
./mysqladmin -u root password '111111'
service mysqld restart
进入Mysql
./mysql -u root -p
//开放mysql 数据源 允许防火墙通过 3306 端口 仅为自己使用。正式部署不需要下面这些命令
grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option
grant all privileges on *.* to 'root'@'%' identified by '111111' with grant option
grant all privileges on *.* to 'root'@'%' identified by 'ROOT-PASSWORD'
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --reload
二、安装php-5.x.xx(最新版本的包)
首先添加依赖应用
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
安装加密扩展库
cd /usr/local/src/
//自行下载libmcrypt包,去公司ftp上查找对应包。
wget libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install
cd ..
wget http://cn2.php.net/distributions/php-5.6.8.tar.bz2
tar -jxvf php-5.6.8.tar.bz2
cd php-5.6.8
///此安装缺少pecl扩展
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-exif --with-zlib --with-gd --enable-mbstring=all --enable-mbregex --enable-gd-native-ttf --with-jpeg-dir --with-freetype-dir --with-curl --with-png-dir --enable-pcntl --enable-soap --enable-sockets --enable-zip --with-pcre-dir --enable-fpm --enable-cli --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --enable-opcache
直接安装包括pecl在内的包
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear
make && make install
复制一份并重命名
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
启动php-fpm
/usr/local/php/sbin/php-fpm
修改FPM 配置文件php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
去掉分号
pm.max_requests = 500
pid = run/php-fpm.pid
保存退出编辑。
ln -s /usr/local/php/sbin/php-fpm /bin/php-fpm
ln -s /usr/local/php/bin/php /bin/php
cp /usr/local/src/php-5.6.8/php.ini-production /usr/local/php/lib/php.ini
三、安装nginx系统
cd /usr/local/src/
添加www nginx运行账户
useradd www
将www加入www组并禁止www登录shell
usermod -s /sbin/nologin -g www www
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar zxvf nginx-1.8.0.tar.gz
cd nginx-1.x.x
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --without-http_rewrite_module --with-http_ssl_module --with-pcre --with-file-aio
make && make install
启动nginx,nginx启动成功。
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx -s reload
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
修改nginx配置文件,根据需要修改对应文件
vim /usr/local/nginx/conf/nginx.conf
去掉前面注释
user nobody;
其他对应内容如下:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
保存退出。
根据 include fastcgi_params;
vim /usr/local/nginx/conf/fastcgi_params
添加以下,否则nginx不能找到php文件进行解析
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
保存退出。
nginx重启
nginx -s reload
将http服务加入防火墙,使得外部可以访问本机。
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --reload
从其他机器浏览器访问本机ip,nginx欢迎页面可以显示。
把下列内容另存为info.php文件,放到nginx对应web目录下。访问,显示php信息页面,即表示php安装成功。
<?php
phpinfo();
?>
四、安装swoole扩展
/usr/local/php/bin/pecl install swoole
编辑 php.ini
vim /usr/local/php/lib/php.ini
添加:
extension=swoole.so
保存退出。
reboot
安装结束。
每次重启动linux需要启动nginx和php
nginx 启动 /usr/local/nginx/sbin
php-fpm 启动 /usr/local/php/sbin/php-fpm
问题:目录没有达到约定的export对应的目录下面。
当前安装的目录:
/usr/local/mysql
/usr/local/php
/usr/local/nginx
web目录:
/usr/local/nginx/html
**********************************************************************************************************************************************************
yum install tcpdump
tcpdump -i any tcp port 9501
查看进程
ps -ef|grep php
ps -auf 查看主脚本的进程pid
先kill -15 主进程ID
然后杀不掉了,在补一句 killall -9
强制关闭进程
kill -s 9 进程号
tar -zxf nginx-1.6.0.tar.gz
cd nginx-1.6.0
./configure --with-pcre --with-file-aio --prefix=/usr/local/nginx
make && make install
yum install libevent-devel readline-devel cmake
tar -zxf mysql-5.6.17.tar.gz
cd mysql-5.6.17
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATE_STORAGE_ENGINE=1
make && make install
yum install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
tar -jxf php-5.5.15.tar.bz2
cd php-5.5.15
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-exif --with-zlib --with-gd --enable-mbstring=all --enable-mbregex --enable-gd-native-ttf --with-jpeg-dir --with-freetype-dir --with-curl --with-png-dir --enable-pcntl --enable-soap --enable-sockets --enable-zip --with-pcre-dir --enable-fpm --enable-cli --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --enable-opcache
./configure --prefix=/usr/local/php --with-mysql --with-mysqli --with-pdo-mysql --with-gd --enable-mbstring --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-freetype-dir --with-png-dir --enable-fpm --enable-opcache
make
make install
adduser -g nobody -s /sbin/nologin mysql
mkdir /export/mysql -p
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/export/mysql/data --user=mysql
cp /export/src/mysql-5.6.17/support-files/my-default.cnf /export/mysql/my.cnf
vim /export/mysql/my.cnf
##################
#skip_socket
skip_name_resolve
#bind-address=127.0.0.1
port=3306
event_scheduler=on
innodb_buffer_pool_size=4096M
long_query_time=0.5
slow_query_log=on
slow_query_log_file=/export/log/mysql-slow.log
#log_bin=log-bin
#binlog_format=mixed
#expire_logs_days=30
#server_id=1
log_error=/export/log/mysql-error.log
###################
chown mysql:nobody /export/mysql/ -R
rm -f /etc/my.cnf
cp /export/src/mysql-5.6.17/support-files/mysql.server.sh /etc/init.d/mysqld
vim /etc/init.d/mysqld
##################
basedir=/usr/local/mysql
datadir=/export/mysql/data
mysqld_pid_file_path=/export/mysql/mysqld.pid
$bindir/mysqld_safe --defaults-file="$datadir/../my.cnf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
##################
chmod a+x /etc/init.d/mysqld
chkconfig mysqld on
service mysqld start
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
tar -zxf automake-1.11.5.tar.gz
cd automake-1.11.5
./configure
make && make install
cd ..
tar -zxf coreseek-4.1-beta.tar.gz
cd coreseek-4.1-beta
cd mmseg-3.2.14/
yum install libtool
./bootstrap
aclocal
libtoolize --force
automake --add-missing
autoconf
autoheader
make clean
./configure --prefix=/usr/local/mmseg
make && make install
cd ..
cd csft-4.1
cp -r /usr/share/aclocal /usr/local/share/aclocal
sh buildconf.sh
export LDFLAGS="-Wl,-rpath -Wl,/usr/local/mysql/lib"
./configure --prefix=/usr/local/csft --with-mmseg --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/ --with-mysql=/usr/local/mysql
make && make install
sed 's/\/\*[!0-9]\+ DEFINER=[^\*]\+\*\///g' mysql-erp-2014-03-13_02.sql >> mysql-erp-2014-03-13_02.sql.no-definer
sed 's/ DEFINER=[^ ]\+//g' mysql-erp-2014-03-28_10.sql > mysql-erp-2014-03-28_10.sql.no-definer
ln -s /usr/local/php/bin/php /usr/local/bin/php
ln -s /usr/local/php/sbin/php-fpm /usr/local/sbin/php-fpm
ln -fs /export/etc/nginx.conf /usr/local/nginx/conf/nginx.conf
ln -fs /export/etc/php.ini /usr/local/php/lib/php.ini
ln -fs /export/etc/php-fpm.conf /usr/local/php/etc/php-fpm.conf
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.24.tar.gz
wget http://cn2.php.net/distributions/php-5.6.8.tar.bz2
wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz
wget http://mirrors.hust.edu.cn/gnu/automake/automake-1.11.5.tar.gz
安装起始:
yum update
reboot
yum install screen wget iptraf unzip subversion man setuptool system-config-firewall-tui system-config-network-tui ntsysv vim links bzip2 net-tools
yum install gcc-c++ pcre-devel zlib-devel make autoconf
yum install memcached-devel libmemcached-devel
yum install samba samba-common samba-client
一、安装mysql
删除系统中已存在的MySQL
1.执行yum命令,删除MySQL的lib库,服务文件
yum remove mysql mysql-server mysql-libs mysql-server
2.执行find命令,查找MySQL的残留文件
find / -name mysql
3.如果存在残留文件,将其删除。
rm -rf *mysql*
删除系统中已存在的MySQL安装包
1.查找是否有mysql安装包
rpm -qa | grep -i mysql
2.如果有,则删除安装包
yum -y remove mysql-libs*
安装新版本mysql
1.首先添加依赖应用
yum install -y gcc gcc-c++ autoconf automake zlib* libxml* libtool-ltdl-devel*
2.安装 cmake 及相关软件 ncurses 和 bison
cd /usr/local/src
wget http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz
tar zxvf cmake-3.0.2.tar.gz
cd cmake-3.0.2
./bootstrap
make && make install
yum install -y ncurses-devel*
yum install -y bison
3.创建 mysql 用户, 创建数据库目录和权限
groupadd mysql
useradd -g mysql mysql
mkdir -p /data/mysql
chown -R root:mysql /data/mysql
4.下载 mysql 源码并且编译 (源码包用最新的)
cd /usr/local/src
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.24.tar.gz
tar xzfv mysql-x.x.xx.tar.gz
cd mysql-xx.xx.xx
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATE_STORAGE_ENGINE=1
gmake
gmake install
5.配置 mysql
cd /usr/local/mysql
cp ./support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf
在 [mysqld] 段增加
datadir = /data/mysql
wait-timeout = 30
max_connections = 512
max_connect_errors = 10000000
default-storage-engine = MyISAM
在 [mysqld] 段修改
max_allowed_packet = 16M
然后保存退出编辑
初始化数据库
./scripts/mysql_install_db --datadir=/data/mysql --basedir=/usr/local/mysql --defaults-file=/etc/my.cnf --user=mysql
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
设置启动脚本变量
编辑 /etc/rc.d/init.d/mysqld
vim /etc/rc.d/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
设置变量环境
#echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile (永久生效)
cd bin
启动服务
service mysqld start
设置数据库管理员root密码
./mysqladmin -u root password '111111'
service mysqld restart
进入Mysql
./mysql -u root -p
//开放mysql 数据源 允许防火墙通过 3306 端口 仅为自己使用。正式部署不需要下面这些命令
grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option
grant all privileges on *.* to 'root'@'%' identified by '111111' with grant option
grant all privileges on *.* to 'root'@'%' identified by 'ROOT-PASSWORD'
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --reload
二、安装php-5.x.xx(最新版本的包)
首先添加依赖应用
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
安装加密扩展库
cd /usr/local/src/
//自行下载libmcrypt包,去公司ftp上查找对应包。
wget libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install
cd ..
wget http://cn2.php.net/distributions/php-5.6.8.tar.bz2
tar -jxvf php-5.6.8.tar.bz2
cd php-5.6.8
///此安装缺少pecl扩展
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-exif --with-zlib --with-gd --enable-mbstring=all --enable-mbregex --enable-gd-native-ttf --with-jpeg-dir --with-freetype-dir --with-curl --with-png-dir --enable-pcntl --enable-soap --enable-sockets --enable-zip --with-pcre-dir --enable-fpm --enable-cli --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --enable-opcache
直接安装包括pecl在内的包
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear
make && make install
复制一份并重命名
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
启动php-fpm
/usr/local/php/sbin/php-fpm
修改FPM 配置文件php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
去掉分号
pm.max_requests = 500
pid = run/php-fpm.pid
保存退出编辑。
ln -s /usr/local/php/sbin/php-fpm /bin/php-fpm
ln -s /usr/local/php/bin/php /bin/php
cp /usr/local/src/php-5.6.8/php.ini-production /usr/local/php/lib/php.ini
三、安装nginx系统
cd /usr/local/src/
添加www nginx运行账户
useradd www
将www加入www组并禁止www登录shell
usermod -s /sbin/nologin -g www www
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar zxvf nginx-1.8.0.tar.gz
cd nginx-1.x.x
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --without-http_rewrite_module --with-http_ssl_module --with-pcre --with-file-aio
make && make install
启动nginx,nginx启动成功。
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx -s reload
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
修改nginx配置文件,根据需要修改对应文件
vim /usr/local/nginx/conf/nginx.conf
去掉前面注释
user nobody;
其他对应内容如下:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
保存退出。
根据 include fastcgi_params;
vim /usr/local/nginx/conf/fastcgi_params
添加以下,否则nginx不能找到php文件进行解析
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
保存退出。
nginx重启
nginx -s reload
将http服务加入防火墙,使得外部可以访问本机。
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --reload
从其他机器浏览器访问本机ip,nginx欢迎页面可以显示。
把下列内容另存为info.php文件,放到nginx对应web目录下。访问,显示php信息页面,即表示php安装成功。
<?php
phpinfo();
?>
四、安装swoole扩展
/usr/local/php/bin/pecl install swoole
编辑 php.ini
vim /usr/local/php/lib/php.ini
添加:
extension=swoole.so
保存退出。
reboot
安装结束。
每次重启动linux需要启动nginx和php
nginx 启动 /usr/local/nginx/sbin
php-fpm 启动 /usr/local/php/sbin/php-fpm
问题:目录没有达到约定的export对应的目录下面。
当前安装的目录:
/usr/local/mysql
/usr/local/php
/usr/local/nginx
web目录:
/usr/local/nginx/html
**********************************************************************************************************************************************************
yum install tcpdump
tcpdump -i any tcp port 9501
查看进程
ps -ef|grep php
ps -auf 查看主脚本的进程pid
先kill -15 主进程ID
然后杀不掉了,在补一句 killall -9
强制关闭进程
kill -s 9 进程号
tar -zxf nginx-1.6.0.tar.gz
cd nginx-1.6.0
./configure --with-pcre --with-file-aio --prefix=/usr/local/nginx
make && make install
yum install libevent-devel readline-devel cmake
tar -zxf mysql-5.6.17.tar.gz
cd mysql-5.6.17
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATE_STORAGE_ENGINE=1
make && make install
yum install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
tar -jxf php-5.5.15.tar.bz2
cd php-5.5.15
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-exif --with-zlib --with-gd --enable-mbstring=all --enable-mbregex --enable-gd-native-ttf --with-jpeg-dir --with-freetype-dir --with-curl --with-png-dir --enable-pcntl --enable-soap --enable-sockets --enable-zip --with-pcre-dir --enable-fpm --enable-cli --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --enable-opcache
./configure --prefix=/usr/local/php --with-mysql --with-mysqli --with-pdo-mysql --with-gd --enable-mbstring --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-freetype-dir --with-png-dir --enable-fpm --enable-opcache
make
make install
adduser -g nobody -s /sbin/nologin mysql
mkdir /export/mysql -p
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/export/mysql/data --user=mysql
cp /export/src/mysql-5.6.17/support-files/my-default.cnf /export/mysql/my.cnf
vim /export/mysql/my.cnf
##################
#skip_socket
skip_name_resolve
#bind-address=127.0.0.1
port=3306
event_scheduler=on
innodb_buffer_pool_size=4096M
long_query_time=0.5
slow_query_log=on
slow_query_log_file=/export/log/mysql-slow.log
#log_bin=log-bin
#binlog_format=mixed
#expire_logs_days=30
#server_id=1
log_error=/export/log/mysql-error.log
###################
chown mysql:nobody /export/mysql/ -R
rm -f /etc/my.cnf
cp /export/src/mysql-5.6.17/support-files/mysql.server.sh /etc/init.d/mysqld
vim /etc/init.d/mysqld
##################
basedir=/usr/local/mysql
datadir=/export/mysql/data
mysqld_pid_file_path=/export/mysql/mysqld.pid
$bindir/mysqld_safe --defaults-file="$datadir/../my.cnf" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
##################
chmod a+x /etc/init.d/mysqld
chkconfig mysqld on
service mysqld start
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
tar -zxf automake-1.11.5.tar.gz
cd automake-1.11.5
./configure
make && make install
cd ..
tar -zxf coreseek-4.1-beta.tar.gz
cd coreseek-4.1-beta
cd mmseg-3.2.14/
yum install libtool
./bootstrap
aclocal
libtoolize --force
automake --add-missing
autoconf
autoheader
make clean
./configure --prefix=/usr/local/mmseg
make && make install
cd ..
cd csft-4.1
cp -r /usr/share/aclocal /usr/local/share/aclocal
sh buildconf.sh
export LDFLAGS="-Wl,-rpath -Wl,/usr/local/mysql/lib"
./configure --prefix=/usr/local/csft --with-mmseg --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/ --with-mysql=/usr/local/mysql
make && make install
sed 's/\/\*[!0-9]\+ DEFINER=[^\*]\+\*\///g' mysql-erp-2014-03-13_02.sql >> mysql-erp-2014-03-13_02.sql.no-definer
sed 's/ DEFINER=[^ ]\+//g' mysql-erp-2014-03-28_10.sql > mysql-erp-2014-03-28_10.sql.no-definer
ln -s /usr/local/php/bin/php /usr/local/bin/php
ln -s /usr/local/php/sbin/php-fpm /usr/local/sbin/php-fpm
ln -fs /export/etc/nginx.conf /usr/local/nginx/conf/nginx.conf
ln -fs /export/etc/php.ini /usr/local/php/lib/php.ini
ln -fs /export/etc/php-fpm.conf /usr/local/php/etc/php-fpm.conf