CentOS7常用操作
1.CentOS卸载firewalld防火墙安装iptables
CentOS 7卸载firewalld防火墙命令
systemctl disable firewalld
systemctl stop firewalld
systemctl mask firewalld
systemctl disable firewalld.service
CentOS 7安装iptables防火墙
yum install iptables -y
yum install iptables-services -y
systemctl enable iptables
systemctl enable iptables.service
systemctl start iptables.service #启动服务
systemctl status iptables.service #运行状态查询
systemctl restart iptables.service #重启服务
service iptables save #保存防火墙规则
2.修改sshd配置
修改ssh配置文件sshd_config
vi /etc/ssh/sshd_config
防火墙放行
向SELinux中添加修改的SSH端口
yum provides semanage
yum -y install policycoreutils-python
查询当前 ssh 服务端口:semanage port -l | grep ssh
向 SELinux 中添加 ssh 端口:semanage port -a -t ssh_port_t -p tcp 22345
重启 ssh 服务:systemctl restart sshd.service
测试成功后,把22端口注释掉即可
3.新增用户
4. 解压缩
tar -zcvf tomcat.tar.gz --exclude=tomcat/logs tomcat
tar -zxvf tomcat.tar.gz
5. 调整history
vi /etc/profile
HISTSIZE=100000
HISTTIMEFORMAT='%F %T '
export HISTSIZE HISTTIMEFORMAT
source /etc/profile