应用服务器安装手册

时间:2022-07-23
本文章向大家介绍应用服务器安装手册,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

环境准备

  • fdisk -l
  • mkfs.ext4 /dev/vdb
  • mount -t ext4 /dev/vdb /data
  • yum update
  • yum -y install gcc gcc-c++ autoconf automake libtool make openssl openssl-devel pcre-devel libxml2-devel libcurl-devel libicu-devel openldap openldap-devel 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 gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel libvpx-devel libaio zip unzip lrzsz

cmake

export CMAKE_HOME=/usr/local/webserver/cmake
export PATH=$PATH:$CMAKE_HOME/bin
  • source /etc/profile

安装最新版libzip

mkdir build 
cd build 
cmake .. 
make 
make install

安装nginx

./configure 
--prefix=/usr/local/webserver/nginx  
--user=nginx 
--group=nginx 
--with-http_ssl_module 
--with-http_flv_module 
--with-http_gzip_static_module 
--with-http_stub_status_module 
--add-module=/opt/nginx-http-concat-master
  • make && make test && make install

安装nginx lua

  • cd /opt/openresty-1.11.2.4
  • cd bundle/
./configure 
--prefix=/usr/local/webserver/nginx  
--user=nginx 
--group=nginx 
--with-http_ssl_module 
--with-http_flv_module 
--with-http_gzip_static_module 
--with-http_stub_status_module 
--add-module=/opt/nginx-http-concat-master 
--add-module=/opt/openresty-1.11.2.4/bundle/ngx_devel_kit-0.3.0 
--add-module=/opt/lua-nginx-module-0.10.10  

安装imagemagick

./configure 
--with-bzlib=yes 
--with-autotrace=yes 
--with-djvu=yes         
--with-dps=yes           
--with-fftw=yes 
--with-flif=yes 
--with-fpx=yes 
--with-fontconfig=yes   
--with-freetype=yes         
--with-gslib=no            
--with-gvc=yes              
--with-jbig=yes             
--with-jpeg=yes             
--with-lcms=yes             
--with-lqr=yes              
--with-ltdl=yes             
--with-lzma=yes             
--with-magick-plus-plus=yes 
--with-openexr=yes          
--with-openjp2=yes          
--with-pango=yes            
--with-perl=no             
--with-png=yes              
--with-raqm=yes             
--with-raw=yes              
--with-rsvg=no             
--with-tiff=yes             
--with-webp=yes             
--with-wmf=yes              
--with-x=                  
--with-xml=yes              
--with-zlib=yes

安装mysql

  • cd /opt
  • wget http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
  • tar zxvf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
  • mv mysql-5.7.23-linux-glibc2.12-x86_64 /usr/local/webserver/mysql
  • groupadd -r mysql
  • useradd -s /sbin/nologin -g mysql -r mysql
  • cd /usr/local/webserver/mysql
  • mv /etc/my.cnf ./#移动默认my.cnf配置
  • vi my.cnf #设置基本配置basedir、datadi等
  • cd support-files/
  • vi mysql.server#修改basedir、datadir与my.cnf保持一致
  • cd /opt
  • chown mysql.mysql ./mysql -R
  • mkdir -p /data/mysql3306/data
  • chown mysql.mysql /data/mysql3306/ -R
  • /usr/local/webserver/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/webserver/mysql --datadir=/data/mysql3306/data
  • #记录初始化root密码
  • /opt/mysql/support-files/mysql.server start
  • /opt/mysql/bin/mysql -uroot -p -S/tmp/mysql3306.sock --default-character-set=utf8
  • > mysql SET PASSWORD = PASSWORD('xxxxx');#初始化root密码
  • > mysql CREATE DATABASE IF NOT EXISTS erp_standard DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
  • > mysql grant select,update,delete,create,insert on erp_standard.* to op@'xxxxx' identified by 'xxxxxx'
  • > mysql flush privileges
  • > mysql q
  • /opt/mysql/support-files/mysql.server restart
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql/ -DMYSQL_DATADIR=/data/mysql3306/data -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost  -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS:string=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DWITH_READLINE=1 -DWITH_SSL=yes -DSYSCONFDIR=/data/mysql3306

安装libmcrypt

安装php5.6

/usr/local/lib                                 # 添加该行
/usr/local/lib64                               # 添加该行             
  • ldconfig -v
  • cd php-5.6.39
./configure 
--prefix=/usr/local/webserver/php5.6 
--with-config-file-path=/usr/local/webserver/php5.6/etc 
--enable-fpm 
--with-fpm-user=www 
--with-fpm-group=www 
--enable-soap 
--enable-gd-native-ttf 
--enable-ftp 
--enable-mbstring 
--enable-exif 
--enable-pdo 
--enable-mbstring 
--enable-opcache 
--enable-sockets 
--enable-pcntl 
--enable-zip 
--enable-calendar 
--enable-bcmath 
--enable-intl 
--with-pdo-mysql 
--with-mysql 
--with-mysqli 
--with-libxml-dir 
--with-pcre-dir 
--with-gd 
--with-vpx-dir 
--with-jpeg-dir 
--with-png-dir 
--with-freetype-dir 
--with-xpm-dir 
--with-iconv-dir 
--with-zlib-dir 
--with-mcrypt 
--with-zlib 
--with-curl 
--with-openssl 
--with-gettext 
--with-mhash 
--with-ldap 
--with-libdir=lib64 
--without-pear 
--disable-phar
  • make && make install
  • cd /usr/local/webserver/php5.6/etc
  • cp /opt/zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so ./lib/php/extensions/no-debug-non-zts-20131226/
  • cp /opt/zend-loader-php5.6-linux-x86_64/opcache.so ./lib/php/extensions/no-debug-non-zts-20131226/
  • cp /opt/php-5.6.31/php.ini-development php.ini
  • cp php-fpm.conf.default php-fpm.conf

安装php7.1

./configure 
--prefix=/usr/local/webserver/php7.1 
--with-config-file-path=/usr/local/webserver/php7.1/etc 
--enable-fpm 
--with-fpm-user=www 
--with-fpm-group=www 
--enable-soap 
--enable-gd-native-ttf 
--enable-ftp 
--enable-mbstring 
--enable-exif 
--enable-pdo 
--enable-mbstring 
--enable-opcache 
--enable-sockets 
--enable-pcntl 
--enable-zip 
--enable-calendar 
--enable-bcmath 
--enable-intl 
--with-pdo-mysql 
--with-mysqli 
--with-libxml-dir 
--with-pcre-dir 
--with-gd 
--with-jpeg-dir 
--with-png-dir 
--with-freetype-dir 
--with-xpm-dir 
--with-iconv-dir 
--with-zlib-dir 
--with-mcrypt 
--with-zlib 
--with-curl 
--with-openssl 
--with-gettext 
--with-mhash 
--with-ldap 
--with-libdir=lib64 
--without-pear 
--disable-phar
  • make && make install
  • cd /usr/local/webserver/php7.1/etc
  • cp /opt/php-7.1.26/php.ini-development php.ini
  • cp php-fpm.conf.default php-fpm.conf

安装php7.3

./configure 
--prefix=/usr/local/webserver/php7.3 
--with-config-file-path=/usr/local/webserver/php7.3/etc 
--enable-fpm 
--with-fpm-user=www 
--with-fpm-group=www 
--enable-soap 
--enable-ftp 
--enable-mbstring 
--enable-exif 
--enable-pdo 
--enable-mbstring 
--enable-opcache 
--enable-sockets 
--enable-pcntl 
--enable-calendar 
--enable-bcmath 
--enable-intl 
--with-pdo-mysql 
--with-mysqli 
--with-libxml-dir 
--with-pcre-dir 
--with-gd 
--with-jpeg-dir 
--with-png-dir 
--with-freetype-dir 
--with-xpm-dir 
--with-iconv-dir 
--with-curl 
--with-openssl 
--with-gettext 
--with-mhash 
--with-ldap 
--with-libdir=lib64 
--without-pear 
--disable-phar
./configure --with-php-config=/usr/local/webserver/php7.3/bin/php-config
make
make install
  • vi php.ini
  • extension=/usr/local/webserver/php7.3/lib/php/extensions/no-debug-non-zts-20180731/zip.so

redis

http://download.redis.io/releases/redis-3.0.1.tar.gz
./make & make test
vim /etc/sysctl.conf #sysctl vm.overcommit_memory=1
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/enabled >> /etc/rc.local
echo 512 > /proc/sys/net/core/somaxconn

tcl

http://jaist.dl.sourceforge.net/project/tcl/Tcl/8.6.4/tcl8.6.4-src.tar.gz 
cd tcl8.6.4/unix/
./configure
./make & make install


## 部署应用
- mkdir -p /data/www/erp_standard/sitedata
- mkdir -p /data/www/erp_standard_www/sitedata 

## 相关文件路径
- nginx
    -  安装路径/usr/local/webserver/nginx
    -  配置文件/usr/local/webserver/nginx/conf
    -  启动/usr/local/webserver/nginx/sbin/nginx
- mysql
    - 安装路径/opt/mysql/
    - 配置文件/opt/mysql/my.cnf
    - 启动/opt/mysql/support-files/mysql.server start
    - 帐号密码:
        - root/root@isnosafe
        - op/t1234567(程序使用)
- php&php-fpm
    - 安装路径/usr/local/webserver/php5.6/
    - 配置文件/usr/local/webserver/php5.6/etc
    - 启动 /usr/local/webserver/php5.6/php-fpm start
- 开机启动
    - /usr/local/webserver/auto_start
    

## root防护
- useradd tripdc
- passwd tripdc
- vi /etc/ssh/sshd_config
- port/PermitRootLogin
- service sshd restart