首页 » 笔记 » 【便捷库】Centos常用环境安装

【便捷库】Centos常用环境安装

@wayne -

系统更新及常用软件安装

yum -y update
yum -y install unzip wget lrzsz

nginx

yum -y localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum -y install nginx
systemctl start nginx
systemctl enable nginx

php

yum -y install epel-release yum-utils
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstriache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-pecl-swool-xmll  php73-php-mysqlnd php73-php-pdo php73-php-posix php73-php-pecl-redis
systemctl enable php73-php-fpm
systemctl start  php73-php-fpm
vi /etc/opt/remi/php73/php.ini
ln -s /opt/remi/php73/root/usr/bin/php /usr/bin/php
systemctl restart  php73-php-fpm

Mysql

wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
sudo yum install mysql-server
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo yum install mysql-server
systemctl enable mysqld.service
systemctl start mysqld.service
mysqld --initialize
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
conf配置案例
server {
    listen       80;
    server_name   qmiss.cn;
    rewrite ^(.*)$ https://$host$1; #强制跳转https
    location / {
           root   /www/home;
        index  index.html index.htm;
        add_header X-Frame-Options sameorigin always;
    }

error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}
}
加装ssl证书
server {
    listen      443 ssl http2;
    server_name qmisscn;
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;
    ssl_certificate /www/letsencrypt/fullchain.pem;
    ssl_certificate_key /www/letsencrypt/privkey.pem;
    ssl_session_timeout 5m;
    ssl_protocols    TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
    ssl_session_cache builtin:1000 shared:SSL:10m;
location / {
    root   /www/home;
    index  index.html index.htm;
    proxy_pass http://;
    }

error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}
}

Java

cd /usr/local

wget https://disk.qmiss.cn/p/2b604d6f3407a3c408f12f29f3e811309e7f78cd/jdk-8u311-linux-x64.tar.gz  

tar zxvf jdk-8u311-linux-x64.tar.gz  

vi /etc/profile

export JAVA_HOME=/usr/local/jdk-18.0.1/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

source /etc/profile

Docker

yum install -y yum-utils
yum-config-manager \
    --add-repo \
    #http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo    #阿里源
    https://download.docker.com/linux/centos/docker-ce.repo    #官方源
    
$ sudo yum -y install docker-ce docker-ce-cli containerd.io
systemctl start docker
systemctl enable docker   #开机自启 
0
0
Comments | 0 条评论
58
  • 感谢打赏
    微信扫一扫 分享朋友圈