centos6安装后简单配置
- 先关掉防火墙和selinux
- iptables -F
- 保存清空的防火墙 /etc/init.d/iptables/ save
- 关闭开机启动 chkconfig iptables off
- 关闭selinux vim /etc/selinux/config
- 重启 reboot
配置好静态IP
vim /etc/sysconfig.network-scripts/ifcfg-eth0
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0c:29:05:45:a8
TYPE=Ethernet
UUID=e674fd78-ed90-4a19-ad7e-13698d551149
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.0.63
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=114.114.114.114
IPV6INIT=no
USERCTL=no
配置主机和IP映射关系
vim /etc/host
127.0.0.1 localhostlocalhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.63 xuegod63.cn xuegod63
192.168.1.64 xuegod64.cn xuegod64
修改主机名
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=xuegod63
[root@xuegod63 ~]# hostname xuegod63 ##立即生效
配置YUM源
[root@xuegod63 ~]# mount /dev/sr0 /mnt/
[root@xuegod63 ~]# echo "/dev/sr0 /mnt iso9660 defaults 0 0" >> /etc/fstab
[root@xuegod63 ~]# rm -rf /etc/yum.repos.d/*
[root@xuegod63 ~]# cat> /etc/yum.repos.d/rhel6.repo <<EOF
> [rhel6-source]
>name=rhel6-source
>baseurl=file:///mnt
> enabled=1
>gpgcheck=0
> EOF
配置网络yum源
阿里云镜像源站点(http://mirrors.aliyun.com/)。
centos镜像参考:http://mirrors.aliyun.com/help/centos
注意要先安装 wget 命令
1. 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2. 下载新的yum源到 /etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-7.repo
如果用的是RHEL6 ,需要修改下repo文件:
sed -i \'s/$releasever/6/g\' CentOS-Base.repo
重建网路YUM源
yum makecache
安装epel源
yum install epel-release –y
YUM安装
yum安装
yum install -y httpd mysql mysql-server php php-mysql
LAMP启动
service httpd restart
chkconfig httpd on
service mysqld start
chkconfig mysqld on
新数据库安装
mysql_secure_installation
测试
mysql -u root -pPASSWD
mysql>show databases;
exit
测试网站是否支持PHP
vim /var/www/html/index.php
<?php
phpinfo();
?>
上传网站模板
安装xshell上传工具
yum install -y lrzsz
解压网站模板
yum install -y unzip
unzip -d ./ucenter UCenter_1.5.0_SC_UTF8.zip
cd ucenter
mkdir /var/www/html/ucadmin
mv upload/* /var/www/html/ucadmin
cd /var/www/html/ucadmin
chown apache:apache data/ -R
打开php段标签
vim /etc/php.ini
改:229 short_open_tag = Off
为:230 short_open_tag = On
重启apache
service httpd restart
测试:http://192.168.1.63/ucadmin/install/
安装主网站模板
unzip -d ./ucenter_home UCenter_Home_2.0_SC_UTF8.zip
cd ucenter_home
mv upload/* /var/www/html/
cd /var/www/html/
chown apache:apache config.php
chown apache:apache attachment/ data/ uc_client/ -R
然后打开连接 安装http://192.168.1.63/install
创始人账号
UCenterAdministrator
配置httpd虚拟主机
vim /etc/hosts
vim /etc/httpd.conf.httpd.conf 添加两个基于域名的虚拟主机。
改:#NameVirtualHost *:80
为:NameVirtualHost *:80
添加两个虚拟主机
第一个:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/ucadmin
ServerName admin.xuegod.cn
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
第二个:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/
ServerName www.xuegod63.cn
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy
</VirtualHost>
修改windows主机的host文件 指向域名
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.1.205 www.xuegod.cn
192.168.1.205 admin.xuegod.cn