美文网首页
centos8 服务器环境部署

centos8 服务器环境部署

作者: 奮鬥猿 | 来源:发表于2020-10-06 09:43 被阅读0次

    1、jdk1.8 检查 yum 中有没有 java1.8 包

    yum list java-1.8*
    

    开始安装

    yum install java-1.8.0-openjdk* -y
    

    2、安装redis https://www.cnblogs.com/hjw-zq/p/9778514.html

    yum install redis
    
    yum install epel-release
    
    systemctl start redis
    
    systemctl status redis
    

    自启动

    systemctl enable redis 
    

    安装数据库

    1、安装RPM

    yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    

    2、安装客户端

    yum install postgresql11
    

    3、安装依赖包

    yum install postgresql11-libs
    
    yum install postgresql11-contrib
    
    yum install postgresql11-devel
    

    4、安装服务器端

    yum install postgresql11-server
    

    5、数据初始化与启动

    /usr/pgsql-11/bin/postgresql-11-setup initdb
    
    systemctl enable postgresql-11
    
    systemctl start postgresql-11
    

    6、修改密码

    passwd postgres
    

    上面的方法无法安装的时候使用下面这种

    sudo dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    
    rpm -qi pgdg-redhat-repo
    
    sudo dnf module disable postgresql
    
    sudo dnf clean all
    
    sudo dnf -y install postgresql11-server postgresql11
    
    dnf info postgresql11-server postgresql11
    

    修改可访问配置

    vim /var/lib/pgsql/11/data/postgresql.conf
    
    listen_addresses = ‘*’
    
    port = 5432
    
    vim /var/lib/pgsql/11/data/pg_hba.conf
    
    host all all 0.0.0.0/0 md5
    
    systemctl restart postgresql-11
    

    安装nginx

    sudo yum install nginx
    
    sudo systemctl enable nginx
    
    sudo systemctl start nginx
    

    脚本自启动

    方法一:

    chmod +x /etc/rc.d/init.d/yourService
    
    cd /etc/rc.d/init.d 
    
    chkconfig --add yourService.sh 
    
    chkconfig yourService.sh on
    

    方法二:(此方法可以正常开机执行,且不会每次登录都执行,推荐)
    自己写的脚本:yourService.sh

    vim /etc/init.d/yourService.sh
    chmod +x /etc/init.d/yourService.sh
    chkconfig --add yourService.sh 
    chkconfig yourService.sh on
    

    相关文章

      网友评论

          本文标题:centos8 服务器环境部署

          本文链接:https://www.haomeiwen.com/subject/akcauktx.html