服务器软件部署

一、数据库mysql

  1. 解压。
    tar zxvf mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz
  2. 移动文件。
    mv ./mysql-5.7.30-linux-glibc2.12-x86_64 /usr/local/mysql
  3. 新建mysql用户、组及目录
    groupadd mysql
    useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql ---新建msyql用户禁止登录shell
  4. 新建数据目录并授权
    mkdir /var/lib/mysql
    mkdir /var/log/mysql
    chown -R mysql:mysql /var/lib/mysql/
    chown -R mysql:mysql /usr/local/mysql
    chown -R mysql:mysql /var/log/mysql
  5. 初始化实例
    bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql
    2020-12-12T03:20:49.923533Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2020-12-12T03:20:50.079254Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2020-12-12T03:20:50.678736Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2020-12-12T03:20:50.742937Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0902b1ac-3c29-11eb-9d93-fa163ed3175f.
    2020-12-12T03:20:50.745297Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
    2020-12-12T03:20:51.564282Z 0 [Warning] CA certificate ca.pem is self signed.
    2020-12-12T03:20:51.931559Z 1 [Note] A temporary password is generated for root@localhost: hHii%XmBr9ee
  6. 添加到系统服务
    6.1 将服务文件拷贝到init.d下
    [root@bogon mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
    6.2 赋予可执行权限
    [root@bogon mysql]# chmod +x /etc/init.d/mysqld
    6.3 添加服务
    [root@bogon mysql]# chkconfig --add mysqld
    6.4 显示服务列表
    [root@bogon mysql]# chkconfig --list
    6.5 启动mysql服务
    [root@bogon mysql]# systemctl start mysql
  7. 修改初始密码,开启账号远程访问
    ./bin/mysql -uroot -p
    set password=password(‘xxx‘);
    flush privileges;
    create user ‘root‘@‘10.100.201.%‘ identified by ‘xxx‘;
    grant all privileges on . to ‘root‘@‘10.100.201.%‘ with grant option;
    flush privileges;

二、redis

  1. tar xzvf redis-5.0.6.tar.gz
  2. mv ./redis-5.0.6 /usr/local/redis-5.0.6
  3. make & make test编译。
  4. 启动redis。
    绑定网卡地址:#127.0.0.1 10.100.201.184
    bind 127.0.0.1 10.100.201.138
    ./src/redis-server /etc/redis-5.0.6.conf

三、ngnix

  1. 安装编译工具及库文件
    yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
  2. 安装 PCRE
    /usr/local/pcre-8.35
    ./configure
    make && make install
  3. 编译配置。(内容替换模块--with-http_sub_module)
    ./configure --prefix=/usr/local/nginx-1.16 --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.35 --with-http_sub_module
    Configuration summary
    using PCRE library: /usr/local/pcre-8.35
    using system OpenSSL library
    using system zlib library
    nginx path prefix: "/usr/local/nginx-1.16"
    nginx binary file: "/usr/local/nginx-1.16/sbin/nginx"
    nginx modules path: "/usr/local/nginx-1.16/modules"
    nginx configuration prefix: "/usr/local/nginx-1.16/conf"
    nginx configuration file: "/usr/local/nginx-1.16/conf/nginx.conf"
    nginx pid file: "/usr/local/nginx-1.16/logs/nginx.pid"
    nginx error log file: "/usr/local/nginx-1.16/logs/error.log"
    nginx http access log file: "/usr/local/nginx-1.16/logs/access.log"
    nginx http client request body temporary files: "client_body_temp"
    nginx http proxy temporary files: "proxy_temp"
    nginx http fastcgi temporary files: "fastcgi_temp"
    nginx http uwsgi temporary files: "uwsgi_temp"
    nginx http scgi temporary files: "scgi_temp"
    make
    make install
    /usr/local/nginx-1.16/sbin/nginx -v
  4. 启动&停止
    ./sbin/nginx
    ./sbin/nginx -s stop
  5. 添加模块。(非必须)
    5.1 ./configure --prefix=/usr/local/nginx-1.16 --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.35 --with-http_sub_module
    Configuration summary
    using PCRE library: /usr/local/pcre-8.35
    using system OpenSSL library
    using system zlib library
    nginx path prefix: "/usr/local/nginx-1.16"
    nginx binary file: "/usr/local/nginx-1.16/sbin/nginx"
    nginx modules path: "/usr/local/nginx-1.16/modules"
    nginx configuration prefix: "/usr/local/nginx-1.16/conf"
    nginx configuration file: "/usr/local/nginx-1.16/conf/nginx.conf"
    nginx pid file: "/usr/local/nginx-1.16/logs/nginx.pid"
    nginx error log file: "/usr/local/nginx-1.16/logs/error.log"
    nginx http access log file: "/usr/local/nginx-1.16/logs/access.log"
    nginx http client request body temporary files: "client_body_temp"
    nginx http proxy temporary files: "proxy_temp"
    nginx http fastcgi temporary files: "fastcgi_temp"
    nginx http uwsgi temporary files: "uwsgi_temp"
    nginx http scgi temporary files: "scgi_temp"
    5.2 make
    5.3 make install
  6. 升级openssl到1.1。(--with-openssl为源码位置,不是安装的位置。如果要用编译后的openssl看6.8)
    6.1 tar zxvf openssl-1.1.1f.tar.gz
    6.2 ./config --prefix=/workdir/openssl-1.1.1f
    6.3 make
    6.4 make install
    6.5 ./configure --prefix=/workdir/nginx-1.18 --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.35 --with-http_sub_module --with-openssl=/workdir/soft/openssl-1.1.1f --with-openssl-opt=enable-tls1_3
    6.6 make
    6.7 make install
    6.8 解决方案:
    打开nginx源文件下的nginx-1.18/auto/lib/openssl/conf文件:
    找到这么一段代码:
CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"

修改成以下代码:

CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"

然后再进行Nginx的编译安装即可

服务器软件部署

上一篇:idea构建简单前端token保存,获取,后端token获取


下一篇:类型转换