Loading... > 由于最近在研究Linux的一些操作,在这里我以刚拿到一个CentOS8系统的机子为例,也是一个记录,防止自己日后配置服务器时忘了 # 一.CentOS Linux 8 升级至 CentOS Stream 8 > 由于CentOS Linux 8的支持维护时间已经变更为2021年12月31日截止,所以升级到CentOS Stream 8很有必要 其实升级很简单,而且CentOS Linux 8 与 CentOS Stream 8普通用户使用起来基本无差别,所以可以放心的平滑升级,升级前先判断当前系统,通过`cat /etc/centos-release`得到不是:`CentOS Stream release 8`,再依次执行如下语句: ``` dnf makecache dnf install -y centos-release-stream dnf swap -y centos-{linux,stream}-repos dnf -y distro-sync ``` 执行后再次通过`cat /etc/centos-release`可以得到:`CentOS Stream release 8`,即代表升级成功 # 二.CentOS Linux 8/CentOS Stream 8开启谷歌TCP-BBR <span style='color:#DC143C'>注意:这个原理是内核大于4.9才可以</span> > 1.对于服务器上的系统而言,提高数据传输速率,减少丢包率是很重要的,而原版的BBR加速就可以起到这样的作用 > 2.为什么我这里不推荐其它BBR脚本呢?因为目前CentOS 8暂时不支持其它的BBR脚本 CentOS Linux 8/CentOS Stream 8开启谷歌TCP-BBR加速前先执行`sysctl -n net.ipv4.tcp_congestion_control`得到不是`bbr`,且执行`lsmod | grep bbr`后得到的返回值中无`tcp_bbr`,再依次执行如下语句: ``` echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf sysctl -p ``` 执行后`reboot`重启系统就好了,然后通过执行`sysctl -n net.ipv4.tcp_congestion_control`得到`bbr`,且执行`lsmod | grep bbr`后得到的返回值中有`tcp_bbr`,即代表开启成功 # 三.CentOS Linux 8/CentOS Stream 8防火墙有关 > 1.如果是国内的云服务器厂商[eg:华为云,腾讯云,阿里云...],控制台上都有安全组,系统自带的防火墙建议直接关闭,用安全组即可,没必要多此一举,而如果是VPS或者是独服,就相对有点用 > 2.CentOS Linux 8/CentOS Stream 8系统自带防火墙就是`firewall`,所以不用安装 * 查看防火墙状态:执行`firewall-cmd --state`得到`running`代表已开启或`systemctl status firewalld`得到绿色点开头的<span style='color:#7FFF00'>active</span>代表已开启 * 开启防火墙:执行`systemctl start firewalld` * 临时关闭防火墙:执行`systemctl stop firewalld` * 永久关闭防火墙:依次执行`systemctl stop firewalld`和`systemctl disable firewalld` * 设置防火墙开机自启:执行`systemctl enable firewalld` * 取消防火墙开机自启:执行`systemctl disable firewalld` * 配置防火墙放行规则: * * 执行`firewall-cmd --add-port=80/udp --permanent`代表放行了UDP协议80端口 * * 执行`firewall-cmd --add-port=80-443/tcp --permanent`代表放行了TCP协议80-443的全部端口 * * 执行`firewall-cmd --add-service=cockpit --permanent`代表放行了cockpit服务的端口 * * 执行`firewall-cmd --reload`使防火墙规则生效 * 配置防火墙阻断规则: * * 执行`firewall-cmd --add-port=80/udp --permanent`代表阻断了UDP协议80端口 * * 执行`firewall-cmd --add-port=80-443/tcp --permanent`代表阻断了TCP协议80-443的全部端口 * * 执行`firewall-cmd --remove-service=cockpit --permanent`代表阻断了cockpit服务的端口 * * 执行`firewall-cmd --reload`使防火墙规则生效 * 查看防火墙放行规则[不显示的均阻断]:执行`firewall-cmd --list-all`查看 # 四.CentOS Linux 8/CentOS Stream 8安装使用GUI图形界面 1. 安装使用GUI图形界面 先安装图形桌面的软件包,执行`yum groupinstall "Server with GUI" -y`,然后设置图形模式为默认模式启动,执行`systemctl set-default graphical`,最后`reboot`,即有图形化界面 2. 进入图形界面 > 由于windows中使用系统自带的远程桌面连接应用更加方便,故我这里推荐并且采用xrdp来实现 依次执行如下语句以安装xrdp: ``` yum install epel* -y yum --enablerepo=epel -y install xrdp ``` 依次执行如下语句以启动xrdp并设置开机启动: ``` systemctl start xrdp systemctl enable xrdp ``` 安装好了之后将防火墙关闭,或者开放3389端口,有安全组的记得放行,有关防火墙请看上文 <span style='color:#DC143C'>卸载GUI图形界面方法:</span> 首先,设置回默认命令界面`systemctl set-default multi-user.target`,然后执行卸载命令:`yum groupremove "GNOME"`;执行`yum remove xrdp`卸载xrdp # 五.CentOS Linux 8/CentOS Stream 8安装并启用Cockpit Web Console > 作为CentOS Linux 8/CentOS Stream 8的新特性就是Cockpit Web Console,这个可以使你在网页上可视化管理系统,功能强大,自我体验感觉还不错 安装&启动依次执行如下语句: ``` dnf install -y cockpit dnf install -y cockpit-machines systemctl start cockpit.socket systemctl enable --now cockpit.socket ``` 开启防火墙的~~需要再执行`firewall-cmd --add-service=cockpit --permanent`,`firewall-cmd --reload`以放通服务~~我的机子安装后自动放通了相关服务端口,没放通的再执行上述语句;有安全组的放行9090端口 查看Cockpit Web Console状态`systemctl status cockpit.socket`,看到绿色点开头的<span style='color:#7FFF00'>active</span>代表已开启 最后修改:2021 年 09 月 12 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 0 如果觉得我的文章对你有用,请随意赞赏,谢谢