资讯专栏INFORMATION COLUMN

php7.0+mysql5.7+nginx1.12.1+vmware共享

MASAILA / 1969人阅读

摘要:创建用户和组编译参数编译初始化密码修改新密码配置开机自启动启动默认默认安装到每次启动启用。

mysql-boost-5.7.11.tar.gz
#创建mysql用户和组
groupadd mysql
useradd -g mysql -s /usr/sbin/nologin mysql
mkdir -p /web/lanmp/mysql/data
mkdir -p /web/lanmp/mysql/logs
mkdir -p /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /web/lanmp/mysql

#编译参数
cmake 
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql 
-DMYSQL_DATADIR=/web/lanmp/mysql/data 
-DWITH_BOOST=boost 
-DSYSCONFDIR=/etc 
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 
-DMYSQL_TCP_PORT=3306 
-DDEFAULT_CHARSET=utf8 
-DDEFAULT_COLLATION=utf8_general_ci 
-DWITH_READLINE=1 
-DWITH_SSL=system 
-DWITH_EMBEDDED_SERVER=1 
-DENABLED_LOCAL_INFILE=1 
-DWITH_ARCHIVE_STORAGE_ENGINE=1 
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 
-DWITH_PARTITION_STORAGE_ENGINE=1 
-DWITH_ARCHIVE_STORAGE_ENGINE=1 
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 
-DWITH_EXAMPLE_STORAGE_ENGINE=1 
-DWITH_FEDERATED_STORAGE_ENGINE=1 
-DWITH_NDB_STORAGE_ENGINE=1 
-DWITH_PARTITION_STORAGE_ENGINE=1

## 编译
make && make install

# 初始化
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/web/lanmp/mysql/data

# root密码修改
mysqladmin -uroot password "新密码"

# 配置开机自启动
cp ./support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on

my.cnf
[client]
port=3306

[mysql]
default-character-set=utf8

[mysqld]
port=3306
basedir=/usr/local/mysql
datadir=/web/lanmp/mysql/data
#server_id=1
character-set-server=utf8
default-storage-engine=InnoDB
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
slow_query_log=1
long_query_time=2
slow-query-log-file=/web/lanmp/mysql/logs/slow.log
local-infile=0
skip-external-locking

max_connections=1000
query_cache_size=0
key_buffer_size=64M
sort_buffer_size=256kb
read_buffer_size=512kb
join_buffer_size=2M
read_rnd_buffer_size=2M
max_allowed_packet=16M
table_open_cache=1024
tmp_table_size=128M
max_heap_table_size=128M

myisam_max_sort_file_size=64G
myisam_sort_buffer_size=32M
myisam_repair_threads=1

innodb_buffer_pool_size=1G
innodb_log_file_size=256M
innodb_log_buffer_size=2M
innodb_file_per_table=1
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=50

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size=20M
sort_buffer_size=20M
read_buffer=2M
write_buffer=2M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
open-files-limit=8192

php7
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd /usr/local/src/libmcrypt-2.5.8
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install

wget https://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make && make install
./configure 
--prefix=/usr/local/php 
--with-config-file-path=/usr/local/php/etc 
--with-mysql=/usr/local/mysql 
--with-mysqli=/usr/local/mysql/bin/mysql_config 
--enable-fpm 
--enable-calendar 
--enable-dba 
--enable-wddx 
--enable-opcache 
--with-fpm-user=php-fpm 
--with-fpm-group=php-fpm 
--with-mysql=mysqlnd 
--with-mysql-sock=/tmp/mysql.sock 
--with-libxml-dir=/usr 
--with-xsl 
--with-gd 
--with-bz2 
--with-kerberos 
--with-gettext=/usr/lib 
--with-jpeg-dir 
--with-png-dir 
--with-zlib 
--with-freetype-dir 
--with-iconv-dir 
--with-zlib-dir 
--with-mcrypt 
--enable-soap 
--enable-gd-native-ttf 
--enable-ftp 
--enable-sockets 
--enable-zip 
--enable-posix 
--enable-pcntl 
--enable-mbstring 
--enable-fpm 
--enable-mbstring 
--with-openssl 
--with-mhash 
--enable-sockets 
--with-xmlrpc 
--enable-zip 
--enable-soap 
--enable-mbregex 
--enable-sysvsem 
--enable-shmop 
--enable-bcmath 
--enable-xml 
--enable-exif 
--disable-ipv6 
--with-pear 
--with-curl 
--with-pdo-mysql 
--enable-inline-optimization 
--disable-fileinfo


make
make install

cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on

cp php.ini-production /usr/local/php/etc/php.ini

启动php-fpm
#/usr/local/php/sbin/php-fpm
service php-fpm start

cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
cd php-fpm.d
cp www.conf.default default.conf

vim default.conf
user = www #默认user = php-fpm
group = www #默认group = php-fpm

nginx
groupadd www
useradd -g www -s /usr/sbin/nologin www
mkdir -p /web/lanmp/nginx/www
chmod +w /web/lanmp/nginx/www
chown -R www:www /web/lanmp/nginx/www
mkdir -p /web/lanmp/nginx/logs
chmod +w /web/lanmp/nginx/logs
chown -R www:www /web/lanmp/nginx/logs

安装 pcre
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
tar zxvf pcre-8.38.tar.gz
cd pcre-8.38
./configure
make && make install

wget http://nginx.org/download/nginx-1.12.1.tar.gz
tar zxvf nginx-1.12.1.tar.gz
cd nginx-1.12.1

./configure 
--user=www 
--group=www 
--prefix=/usr/local/nginx 
--with-http_stub_status_module 
--with-http_ssl_module 
--with-http_realip_module 
--with-http_image_filter_module 
--with-file-aio 
--with-threads 
--with-debug

make && make install

ulimit -SHn 65535
到 /etc/rc.local 每次启动启用。
终极解除 Linux 系统的最大进程数和最大文件打开数限制:
vim /etc/security/limits.conf
# 添加如下的行
* soft nproc 11000
* hard nproc 11000
* soft nofile 655350
* hard nofile 655350
/etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
#              It has a lot of features, but it"s not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
   echo "nginx already running...."
   exit 1
fi
   echo -n $"Starting $prog: "
   daemon $nginxd -c ${nginx_config}
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
   return $RETVAL
}
# Stop nginx daemons functions.
stop() {
        echo -n $"Stopping $prog: "
        killproc $nginxd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
# reload nginx service functions.
reload() {
    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo
}
# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload)
        reload
        ;;
restart)
        stop
        start
        ;;
status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac
exit $RETVAL
chmod +x /etc/init.d/nginx
chkconfig nginx on
vmware 挂载win共享目录
#win机上操作
#创建share目录和share账号,开启共享,加入用户share和everyone全部权限

mkdir /web/lanmp/nginx/share
mount -o username=share,password=share,uid=www,gid=www //win机子的ip/share /web/lanmp/nginx/share
软件包下载地址
#mysql 5.7.20
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.20.tar.gz
#php
http://php.net/downloads.php 自行选择版本下载
#nginx 
wget http://nginx.org/download/nginx-1.12.2.tar.gz 

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/39657.html

相关文章

  • ubuntu14.04 lnmp(nginx1.9+php7.0+mysql5.7)

    摘要:引导语最近在网上看了很多,关于各种配置最新的环境配置,对于很多新手可能总会遇到那么一两点他们完全不知道的,所以接下来所写的环境配置完全适合新手按照命令直接操作。感谢原文此木依南 引导语 最近在网上看了很多,关于各种ubuntu14.04配置最新nginx+php7.0+mysql5.7的环境配置,对于很多新手可能总会遇到那么一两点他们完全不知道的,所以接下来所写的环境配置完全适合新手按...

    wenyiweb 评论0 收藏0
  • ubuntu14.04 lnmp(nginx1.9+php7.0+mysql5.7)

    摘要:引导语最近在网上看了很多,关于各种配置最新的环境配置,对于很多新手可能总会遇到那么一两点他们完全不知道的,所以接下来所写的环境配置完全适合新手按照命令直接操作。感谢原文此木依南 引导语 最近在网上看了很多,关于各种ubuntu14.04配置最新nginx+php7.0+mysql5.7的环境配置,对于很多新手可能总会遇到那么一两点他们完全不知道的,所以接下来所写的环境配置完全适合新手按...

    wpw 评论0 收藏0

发表评论

0条评论

MASAILA

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<