最小化安装centos8 之后, 快速初始化环境, 使新机器最短时间可以上线作为开发机/生产机使用
停止维护,最新版本为 https://github.com/xisj/centos9-fast-init
dnf install -y epel-release dnf-plugins-core
dnf install -y wget git vim lrzsz screen net-tools telnet iftop bind-utils tar psmisc &&\
wget "https://raw.githubusercontent.com/xisj/centos8-fast-init/master/vps/fast.sh" &&\
screen sh fast.sh
dnf install -y epel-release dnf-plugins-core &&\
dnf config-manager --set-enabled PowerTools &&\
dnf install -y wget git vim lrzsz screen net-tools telnet iftop bind-utils tar psmisc &&\
git clone https://github.com/xisj/centos8-fast-init.git &&\
vim centos8-fast-init/vps/lnmp.sh &&\
scp root@xxxxxxxxxxxxx.com:/data1.tar.gz /data1.tar.gz &&\
cd / &&\
tar -xzf /data1.tar.gz / &&\
cd /root/centos8-fast-init/vps/ &&\
sh lnmp.sh
ClientAliveInterval 60
ClientAliveCountMax 60
cd centos9-fast-init/vps/
screen sh ban.sh
dnf install fail2ban
systemctl start fail2ban
systemctl enable fail2ban
fail2ban-client ping
fail2ban-client status
修改 /etc/fail2ban/jail.conf
[ssh-iptables]
enabled = true
filter = sshd
action = iptables[name=SSH, port=22, protocol=tcp]
#sendmail-whois[name=SSH, dest=your@email.com, sender=fail2ban@email.com]
logpath = /var/log/secure
maxretry = 3
bantime = 370
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum update
#centos8 对镜像的选择做的不错,一般情况下无需替换 #备份
cd /etc/yum.repos.d
#备份
cp -R /etc/yum.repos.d /etc/bak.yum.repos.d
sed -i 's/mirrorlist=/#mirrorlist=/g' CentOS-*.repo
sed -i 's/#baseurl=/baseurl=/g' CentOS-*.repo
sed -i 's/http:\/\/mirror.centos.org/https:\/\/mirrors.aliyun.com/g' CentOS-*.repo
#下载fedora的epel仓库
dnf install -y epel-release
#刷新数据
dnf makecache
#更新到最新
screen dnf update -y
vi /etc/sysconfig/network-scripts/ifcfg-ens33
#修改 ONBOOT=no 为 ONBOOT=yes
#重启网络服务
service network restart
#查看ip
ip addr
可选操作:
timedatectl set-timezone "Asia/Shanghai"
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
semanage port -m -t ssh_port_t -p tcp 80
https://sourceforge.net/projects/mingw-w64/files/
--- ffmpeg 推荐安装ffmpeg* ,这样不会因为缺少库出现奇怪问题
dnf -y install https://download.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf -y localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm
dnf -y install --nogpgcheck https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
dnf -y install http://rpmfind.net/linux/epel/7/x86_64/Packages/s/SDL2-2.0.10-1.el7.x86_64.rpm
dnf install -y ffmpeg*
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
ssh-keygen -t rsa #本地生成秘钥, 若已有可省略
ssh-copy-id -i ~/.ssh/id_rsa.pub devuser@xisj.com #将本地秘钥拷贝到服务器
ssh -D :7777 -N admin@example.com
