标签:freetype toc 最新 inline useradd char led mysql用户 ima
centos6.5+Nginx1.14+MySQL8.0+PHP7.0nginx -V 2>&1 | grep "configure arguments:" | sed ‘s/[^*]*--user=\([^ ]*\).*/\1/g‘ -
$nginx -V 2>&1 | grep ‘configure arguments:‘
echo $opt | grep ‘.*-temp-path‘
]; thenecho $opt | cut -d "=" -f 2
为启动脚本添加权限
#chmod +x /etc/rc.d/init.d/nginx
#chkconfig --add nginx
#chkconfig nginx on
#service nginx restart
启动中可能会遇到的问题
nginx: [emerg] getpwnam("nginx") failed #未建立nginx用户和用户组
查看端口是否监听
#netstat -tlunp |grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0: LISTEN 6431/nginx
可以网页测试 浏览器输入IP地址 看到welcome to nginx 则表示成功
二、MySQL二进制安装(mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz)
1、先卸载之前版本的MySQL组件 #rpm -e
2、安装新版的MySQL组件
#rpm -ivh mysql-community-client-8.0.13-1.el6.x86_64.rpm
#rpm -ivh mysql-community-common-8.0.13-1.el6.x86_64.rpm
#rpm -ivh mysql-community-devel-8.0.13-1.el6.x86_64.rpm
#rpm -ivh mysql-community-libs-8.0.13-1.el6.x86_64.rpm
3、新建数据文件夹
#mkdir -p /mydata/data
4、新建mysql用户与组
#groupadd -r mysql
#useradd -g mysql -r -s /sbin/nologin -M -d /mydata/data mysql
#chown mysql:mysql /mydata/data
5、安装MySQL8.0.13
#tar -Jxvf mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz -C /usr/local
#cd /usr/local
#ln -sv mysql-5.5.24-linux2.6-i686 mysql
#cd mysql
#chown -R mysql:mysql .
#/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/mydata/data --initialize-insecure
#chown -R root .
6、为MySQL提供主配置文件
#vi /etc/my.cnf
[mysqld]
server-id = 1
port = 3306
mysqlx_port = 33060
mysqlx_socket = /mydata/data/mysqlx.sock
datadir = /mydata/data
socket = /mydata/data/mysql.sock
pid-file = /mydata/data/mysqld.pid
log-error = /mydata/data/error.log
slow-query-log = 1
slow-query-log-file = /mydata/data/slow.log
long_query_time = 0.2
log-bin = /mydata/data/bin.log
relay-log = /mydata/data/relay.log
binlog_format =ROW
relay_log_recovery = 1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect =‘SET NAMES utf8mb4‘
innodb_buffer_pool_size = 1G
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
log_timestamps = SYSTEM
lower_case_table_names = 0
default-authentication-plugin =mysql_native_password
sql_mode =NO_ENGINE_SUBSTITUTION
7、提供启动服务脚本
#cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
#vi /etc/rc.d/init.d/mysqld #更改一下几项
basedir=/usr/local/mysql
datadir=/mydata/data
mysqld_pid_file_path=/mydata/data/mysqld.pid
为启动脚本添加权限
#chmod +x /etc/rc.d/init.d/mysqld
#chkconfig --add mysqld
#chkconfig mysqld on
#service mysqld restart
8、添加MySQL的man手册
#vi /etc/man.conf
MANPATH /usr/local/mysql/man
9、输出mysql的头文件至系统头文件路径/usr/include
#ln -sv /usr/local/mysql/include /usr/include/mysql
10、输出mysql的库文件给系统库
#echo ‘/usr/local/mysql/lib‘ > /etc/ld.so.conf.d/mysql.conf
#ldconfig
11、修改PATH环境变量,让系统可以直接使用mysql的相关命令
12、常见报错
1251--Client does not support authentication protocol requested by server
#卸载之前的MySQL版本
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2) #无套接字文件
ln -s /mydata/data/mysql.sock /var/lib/mysql/mysql.sock
三、PHP安装(php-7.0.33.tar.bz2)
1、安装前准备--解决软件依赖关系
安装mcrypt、mcrypt-devel、mhash、mhash-devel、libevent、libevent-devel与yum -y groupinstall "X Software Development"
2、解压并安装PHP
#tar -jxvf php-7.0.33.tar.bz2
#cd php-7.0.33
./configure --prefix=/usr/local/php --with-pdo-mysql=/usr/local/mysql --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir=/usr --enable-xml --with-mhash --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-curl --enable-mysqlnd --with-mysqli --with-pdo_mysql --enable-bcmath
#make
#make test
#make install
3、为PHP提供配置文件
#cp /usr/local/php.ini-production /etc/php.ini
4、为php-fpm提供配置文件
#cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
5、为PHP-FPM提供服务脚本文件
#cp 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
#service php-fpm restart
常用报错
1、configure: error: mcrypt.h not found. Please reinstall libmcrypt.
#安装libmcrypt
2、/usr/local/src/php-5.6.38/ext/mysqli/php_mysqli_structs.h:63:23: 致命错误:my_global.h:没有那个文件或目录
./configure 加上 --enable-mysqlnd --with-mysqli
3、usr/local/src/php-5.6.38/ext/pdo_mysql/php_pdo_mysql_int.h:138:2: 错误:未知的类型名‘my_bool’ my_bool in_null;
./configure 加上 --with-pdomysql
4、configure: error: xml2-config not found. Please check your libxml2 installation
安装libxml2-devel
5、configure: error: Please reinstall the BZip2 distribution
安装bzip2-devel
6、configure: error: jpeglib.h not found
安装libjpeg-turbo-devel
7、configure: error: png.h not found
安装libpng-devel
8、configure: error: freetype-config not found
安装freetype-devel
9、WARNING: Nothing matches the include pattern ‘/usr/local/php/etc/php-fpm.d/.conf‘ from /usr/local/php/etc/php-fpm.conf at line 125
#cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf 复制*
10、ERROR: failed to open configuration file ‘/usr/local/php/etc/php-fpm.conf‘: No such file or directory
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
四、整合nginx与php
1、编辑/etc/nginx/nginx.conf,启用如下选项:
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;
}
location / {
root html;
index index.php index.html index.htm;
}
2、编辑/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;
而后重新载入nginx的配置文件: # service nginx reload
3、在/usr/html新建index.php的测试页面,测试php是否能正常工作:
#cat > /usr/html/index.php << EOF
<?php
phpinfo();
?> 接着就可以通过浏览器访问此测试页面了。
标签:freetype toc 最新 inline useradd char led mysql用户 ima
原文地址:http://blog.51cto.com/2937761/2342818