Centos7 简单开机配置

2020-04-03 12:03
548
0

USB 启动 安装配置:

#USB安装需要 
#启动项按E 找到编辑以下内容编辑:
vmlinuz initrd=initrd.img linux dd quiet

查看确定USB盘符后修改为 :

vmlinuz initrd=initrd.img inst.stage2=hd:/dev/sdb4 quiet

 

epel:

#查询是否已经安装epel库

rpm -qa|grep epel

yum install -y epel-release

 

开启 sudo:

vim  /etc/sudoers

root        ALL=(ALL)       ALL
#add
username    ALL=(ALL)       ALL

 

常用软件:

#先卸掉防火墙
systemctl disable firewalld
yum remove firewalld

#安装常用的
yum install vim 
yum install wget
yum install zip 
yum install unzip 
yum install screen
yum install ntp
yum install iptables-services

#mariadb https://zhuihoude.com/article/install_mariadb
#tomcat  https://zhuihoude.com/article/Java_environment_variables

#全部的自启动
systemctl enable tomcat nginx mariadb crond ntpd iptables

 

配置一下 iptables:

#先卸载 firewalld

systemctl stop firewalld

yum remove firewalld

yum install iptables-services

#安装出错的话可以卸载再来一次
yum remove iptables-services
yum install iptables-services

#编辑配置
sudo vim /etc/sysconfig/iptables

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22    -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80    -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443   -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306  -j ACCEPT


#如果有需要udp(只是举例实际并不需要 ucp在22端口)
-A INPUT -p udp -m state --state NEW -m udp --dport 22 -j ACCEPT

#重启iptables
systemctl restart iptables


#其他的自己百度去

 

配置一下网络:

sudo vim /etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO="static"
IPADDR=192.168.1.3
IPADDR2=192.168.31.3
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DNS2=192.168.1.1

 

echo "mount -t cifs //192.168.1.166/share /data/website/share -o username=root,password=123456" >> /etc/rc.local && chmod 777 /etc/rc.local && chmod -R 777 /etc/rc.d

 

全部评论