CentOS安装后基本命令

2019-01-09  本文已影响0人  pianosecret

修改主机名

# hostnamectl set-hostname <host-name>

修改密码

# passwd

更新yum

#yum update

yum源修改为阿里

 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak 
 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 yum makecache
 yum -y update 

安装apache

yum -y install apache
systemctl start httpd
systemctl enable httpd

其中apache的主要目录以及用途
服务目录    /etc/httpd
主配置文件   /etc/httpd/conf/httpd.conf
网站数据目录  /var/www/html
访问日志    /var/log/httpd/access_log
错误日志    /var/log/httpd/error_log

主要参数有
ServerRoot  服务目录
ServerAdmin 管理员邮箱
User    运行服务的用户
Group   运行服务的用户组
ServerName  网站服务器的域名
DocumentRoot    网站数据目录
Listen  监听的IP地址与端口号
DirectoryIndex  默认的索引页页面
ErrorLog    错误日志文件
CustomLog   访问日志文件
Timeout 网页超时时间,默认为300秒.
Include 需要加载的其他文件

配置php

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum list php*
yum -y install php72w
yum -y install php72w-cli php72w-common php72w-devel php72w-mysql
yum -y install php72w-gd php72w-imap php72w-ldap php72w-odbc php72w-pear php72w-xml php72w-xmlrpc
find / -name php.ini
find / -name httpd.conf
在httpd.conf最后加上  
PHPIniDir /etc/php.ini 让httpd知道php的配置信息
ps aux | grep httpd
打开防火墙80端口  
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --query-port=80/tcp
systemctl restart httpd
php -v
上一篇下一篇

猜你喜欢

热点阅读