标签:kill stop ges sshd read 启动文件 时区 esc pcre
新装CentOS 6.7,安装默认服务版本basic server
安装顺序linux(忽略...)--> Nginx--> Mariadb--> PHP
为了不影响测试效果,首先关闭selinux及iptables。校对系统时间。
iptables -F chkconfig iptables off vi /etc/selinux/config 将 SELINUX=enforcing 更改为 SELINUX=disabled 修改时区 cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 安装rz上传组件: yum install lrzsz -y
1、安装Nginx:
安装依赖,新建文件夹,rz上传nginx安装包。
mkdir packet cd packet/
groupadd -r nginx useradd -r -g nginx nginx
tar xf nginx-1.11.5.tar.gz cd nginx-1.11.5 ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/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
nginx="/usr/local/nginx/sbin/nginx" (configure参数中--sbin-path参数) NGINX_CONF_FILE="/etc/nginx/nginx.conf"(nginx配置文件,configure参数中 --conf-path参数) vi /etc/rc.d/init.d/nginx #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # description: Nginx is an HTTP(S) server, HTTP(S) reverse # proxy and IMAP/POP3 proxy server # processname: nginx # config: /etc/nginx/nginx.conf # config: /etc/sysconfig/nginx # pidfile: /var/run/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/local/nginx/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/etc/nginx/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx make_dirs() { # make required directories user=`$nginx -V 2>&1 | grep "configure arguments:" | sed ‘s/[^*]*--user=\([^ ]*\).*/\1/g‘ -` options=`$nginx -V 2>&1 | grep ‘configure arguments:‘` for opt in $options; do if [ `echo $opt | grep ‘.*-temp-path‘` ]; then value=`echo $opt | cut -d "=" -f 2` if [ ! -d "$value" ]; then # echo "creating" $value mkdir -p $value && chown -R $user $value fi fi done } start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac
chmod +x /etc/rc.d/init.d/nginx
chkconfig --add nginx chkconfig nginx on service nginx start
mkdir -p /mydata/data fdisk /dev/sdb
mkfs.ext4 /dev/sdb1
vi /etc/fstab /dev/sdb1 /mydata/data ext4 defaults 0 0 挂载 mount -a
groupadd -r mysql useradd -g mysql -r -s /sbin/nologin -M -d /mydata/data mysql
tar xf mariadb-10.1.18-linux-x86_64.tar.gz ln -sv /root/packet/mariadb-10.1.18-linux-x86_64 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql .
scripts/mysql_install_db --user=mysql --datadir=/mydata/data
chown -R root .
cp /usr/local/mysql/support-files/my-large.cnf /etc/my.cnf
vi /etc/my.cnf # Try number of CPU‘s*2 for thread_concurrency (CPU数量*2) thread_concurrency = 2 datadir = /mydata/data
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on
vi /etc/man.config 新增行 MANPATH /usr/local/mysql/man
mysql的头文件输出至系统的头文件
ln -sv /usr/local/mysql/include /usr/include/mysql
echo ‘/usr/local/mysql/lib‘ > /etc/ld.so.conf.d/mysql.conf
ldconfig
vi /etc/profile 末尾新增行 PATH=/usr/local/mysql/bin:$PATH export PATH
source /etc/profile
service mysqld start
yum -y groupinstall "X Software Development" yum -y install libxml2 libxml2-devel bzip2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
rz上传php,解压并编译安装
tar xf php-5.6.27.tar.bz2 cd php-5.6.27 ./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath make && make test && make install
cp packet/php-5.6.27/php.ini-production /etc/php.ini
cp packet/php-5.6.27/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
vi /usr/local/php/etc/php-fpm.conf pm.max_children = 150 pm.start_servers = 8 pm.min_spare_servers = 5 pm.max_spare_servers = 10 pid = /usr/local/php/var/run/php-fpm.pid
service php-fpm start
vi /etc/nginx/nginx.conf 添加index.php location / { root html; index index.html index.htm index.php; } 启用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_params; }
vi /etc/nginx/fastcgi_params fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name;
service nginx reload
cd /usr/local/nginx/ html/ vi index.php <?php phpinfo(); ?>
[root@localhost ~]# netstat -antp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2201/php-fpm tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2715/nginx tcp 0 0 127.0.0.1:34197 0.0.0.0:* LISTEN 2903/sshd tcp 0 0 127.0.0.1:34198 0.0.0.0:* LISTEN 2903/sshd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2225/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2020/cupsd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2585/master tcp 0 0 172.28.1.8:10051 172.28.1.5:51231 TIME_WAIT - tcp 0 52 172.28.1.8:22 172.28.1.5:51242 ESTABLISHED 2903/sshd tcp 0 0 :::3306 :::* LISTEN 2444/mysqld tcp 0 0 ::1:34197 :::* LISTEN 2903/sshd tcp 0 0 ::1:34198 :::* LISTEN 2903/sshd tcp 0 0 :::22 :::* LISTEN 2225/sshd tcp 0 0 ::1:631 :::* LISTEN 2020/cupsd tcp 0 0 ::1:25 :::* LISTEN 2585/master [root@localhost ~]#
标签:kill stop ges sshd read 启动文件 时区 esc pcre
原文地址:http://www.cnblogs.com/armo/p/6067716.html