多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` #拉取最新的centos镜像 docker pull centos #创建env容器并且启用systemd(可以使用systemd) docker run -d --privileged=true --name env centos /usr/sbin/init #进入容器 docker exec -it env /bin/bash #设置时区 timedatectl set-timezone Asia/Shanghai #更新软件包 yum update -y #安装epel源 yum install -y epel-release #安装wget等 yum install -y wget #创建软件包存放目录 mkdir ~/soft-source #安装nginx cd ~/soft-source wget http://nginx.org/download/nginx-1.15.5.tar.gz tar -zxf nginx-1.15.5.tar.gz cd nginx-1.15.5 yum install -y gcc pcre pcre-devel openssl openssl-devel ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-pcre make && make install #修改nginx默认配置 mkdir /usr/local/nginx/conf/vhost echo '' > /usr/local/nginx/conf/nginx.conf vi /usr/local/nginx/conf/nginx.conf --- worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; server_tokens off; gzip on; include vhost/*.conf; } --- #安装nginx服务 vi /usr/lib/systemd/system/nginx.service --- [Unit] Description=The NGINX HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStartPre=/usr/local/nginx/sbin/nginx -t ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target --- systemctl enable nginx #安装php cd ~/soft-source wget http://cn2.php.net/distributions/php-7.2.11.tar.gz tar -zxf php-7.2.11.tar.gz cd php-7.2.11 yum install -y gcc gcc-c++ systemd-devel libxml2 libxml2-devel curl curl-devel bzip2 bzip2-devel libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel freetype freetype-devel libicu libicu-devel openssl openssl-devel pcre pcre-devel ./configure --prefix=/usr/local/php --with-bz2 --enable-zip --with-zlib --with-mhash --with-openssl --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-calendar --with-gettext --enable-mbstring --enable-exif --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-bcmath --with-curl --enable-ftp --enable-sockets --enable-libxml --enable-fpm --enable-pcntl --enable-soap --enable-opcache --with-xmlrpc --enable-intl --enable-shmop --with-fpm-systemd make && make install cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf cp ~/soft-source/php-7.2.11/sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service cp ~/soft-source/php-7.2.11/php.ini-production /usr/local/php/lib/php.ini systemctl enable php-fpm #安装php扩展 yum install -y autoconf /usr/local/php/bin/pecl channel-update pecl.php.net /usr/local/php/bin/pecl install APCu yum install -y libmemcached-devel /usr/local/php/bin/pecl install memcached /usr/local/php/bin/pecl install igbinary /usr/local/php/bin/pecl install redis yum install -y hiredis-devel libnghttp2-devel /usr/local/php/bin/pecl install swoole yum install -y GraphicsMagick-devel /usr/local/php/bin/pecl install channel://pecl.php.net/gmagick-2.0.5RC1 /usr/local/php/bin/pecl install yaf /usr/local/php/bin/pecl install mongodb vi /usr/local/php/lib/php.ini --- extension=apcu extension=memcached extension=igbinary extension=redis extension=swoole extension=gmagick extension=yaf extension=mongodb --- #安装mysql cd ~/soft-source/ wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm yum localinstall mysql80-community-release-el7-1.noarch.rpm yum install -y mysql-community-server systemctl enable mysqld systemctl start mysqld grep 'temporary password' /var/log/mysqld.log mysql -uroot -p --- mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '!Aa123456'; mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '!Aa123456'; --- vi /etc/my.cnf --- default-authentication-plugin=mysql_native_password --- systemctl restart mysqld mysql -uroot -p --- mysql> CREATE USER 'root'@'%' IDENTIFIED BY '!Aa123456'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; --- #安装redis yum install -y redis systemctl enable redis more /etc/redis.conf #安装memcached yum install -y memcached systemctl enable memcached more /etc/sysconfig/memcached #安装momgodb vi /etc/yum.repos.d/mongodb-org-4.2.repo --- [mongodb-org-4.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc --- yum install -y mongodb-org systemctl enable mongod more /etc/mongod.conf ```