CentOS装机常用命令

CentOS 7 :

1、安装network,才可以使用ifconfig命令查看ip地址:

yum install net-tools
 
  

2、安装ftp服务,远程控制

yum install vsftpd
3、安装svn版本控制工具
yum install subversion

4、安装上传下载插件

yum install lrzsz

5、安装httpd

yum install httpd
systemctl start httpd.service
systemctl enable httpd
 6、打开防火墙的80端口 
  
firewall-cmd --add-service=http              (即时打开)
firewall-cmd --permanent --add-service=http  (写入配置文件)
/etc/firewalld/zones/public.xml(firewolld配置文件)
/usr/lib/firewalld/services/http.xml(httpd配置文件)

7、关闭firewall防火墙,安装iptables

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动

8、安装mysql,下载地址:http://dev.mysql.com/downloads/repo/ 

<pre name="code" class="html">yum localinstall mysql57-community-release-el7-7.noarch.rmp
yum install mysql-community-server(或直接用:rpm -ivh mysql-community-release-el6-5.noarch.rpm)
systemctl start mysqld.service(启动msyql)
root默认密码在日志中(/var/log/mysql.log)
mysql_secure_installation命令可以修改密码
防火墙修改:firewall--cmd --add-service=mysql ;firewall-cmd --permanent --add-service=mysql;
update user set host='%' where user='root';让所有ip地址都可以访问;

 9、安装php 
  

yum install php





你可能感兴趣的:(CentOS装机常用命令)