Linux下相关配置

#关闭selinux
vim /etc/sysconfig/selinux
SELINUX=disabled

#修改ssh

sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
sed -i 's/#ClientAliveInterval 0/ClientAliveInterval 60/' /etc/ssh/sshd_config
sed -i 's/#StrictModes yes/StrictModes no/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#GatewayPorts no/GatewayPorts yes/' /etc/ssh/sshd_config
sed -i 's/#AllowAgentForwarding yes/AllowAgentForwarding yes/' /etc/ssh/sshd_config
sed -i 's/#AllowTcpForwarding yes/AllowTcpForwarding yes/' /etc/ssh/sshd_config

#去除bash声音
sed -i 's/#set bell-style none/set bell-style none/' /etc/inputrc

#去除vim哔哔声音
echo set noeb vb t_vb= >> /etc/vimrc

#修改终端字体颜色//.bashrc
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        color_prompt=yes
    else
        color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

#自动登录
.ssh目录下创建authorized_keys并添加公钥

#安装jdk
vim /etc/profile
export JAVA_HOME=/usr/local/Jdk
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile

#安装tomcat
vim /etc/profile
export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:$CATALINA_HOME/bin
source /etc/profile
serve.xml 80 URIEncoding="UTF-8"

#安装mysql
rpm -qa |grep -i mariadb
rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64
yum install libaio
rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm
systemctl start mysqld
ps -ef|grep mysql
netstat -anop|grep 3306
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
set global validate_password_policy=0;
set global validate_password_length=1;
alter user 'root'@'localhost' identified by 'Aa09170314';
grant all privileges on *.* to root@'%' identified by 'Aa09170314';

#pptpd
yum install epel-release ppp pptpd
yum install iptables-services

vim /etc/sysctl.conf
net.ipv4.ip_forward=1
sysctl -p

vim /etc/pptpd.conf
localip 192.168.0.1
remoteip 192.168.0.2-238,192.168.0.245

vim /etc/ppp/chap-secrets
jackie        pptpd   Aa09170314              *
yum install iptables
yum install iptables-services

vim /etc/sysconfig/iptables
iptables -I INPUT -p tcp --dport 1723 -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to 172.24.0.142
iptables -I INPUT -p gre -j ACCEPT
iptables -I FORWARD -i ppp+ -o eth0 -j ACCEPT
iptables -I FORWARD -i eth0 -o ppp+ -j ACCEPT
iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356
service iptables save

vim /etc/ppp/options.pptpd
require-mppe
logfile /var/log/pptpd.log
ms-wins 8.8.8.8
ms-wins 8.8.4.4

#proxy
ssh -R 80:localhost:8080 root@3.114.189.134
ssh -D *:10086 root@3.114.189.134

#Git
git ls-tree -r master --name-only

#开放端口
firewall-cmd --zone=public --add-port=5672/tcp --permanent   # 开放5672端口
firewall-cmd --zone=public --remove-port=5672/tcp --permanent  #关闭5672端口
firewall-cmd --reload   # 配置立即生效

#查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports

#关闭防火墙,如果要开放的端口太多,嫌麻烦,可以关闭防火墙,安全性自行评估
systemctl stop firewalld.service

#检查端口被哪个进程占用
netstat -lnpt |grep 5672

#中止进程
kill -9 5672

#mysql
mysql -u root -h cdb-6c2ne31o.bj.tencentcdb.com -P 10253  -p
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值