CentOS 下Apache+PHP+MySQL 服务器配置(上)

1、用ssh远程已安装好的CentOS服务器,却无法连接。远程登陆同机房另一台Windows 2003, 用2003 ssh 这台CentOS 成功,初步判断为IP、网关设置问题。
2、SSH登陆CentOS后发现命令行乱码,于是 # vi /etc/sysconfig/i18n 将LANG="zh_CN.UTF-8"
改为:
LANG="zh_CN.GB18030"
LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
SYSFONT="lat0-sun16"
保存退出,命令行正常显示中文了。
3、接着修改对应网卡的IP地址的配置文件,
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 修改以下内容 DEVICE=eth0 #描述网卡对应的设备别名,例如ifcfg-eth0的文件中它为eth0 BOOTPROTO=static #设置网卡获得ip地址的方式,可能的选项为static,dhcp或bootp,分别对应静态指定的 ip地址,通过dhcp协议获得的ip地址,通过bootp协议获得的ip地址 HWADDR=00:07:E9:05:E8:B4 #对应的网卡物理地址 IPADDR=202.100.84.170 #如果设置网卡获得 ip地址的方式为静态指定,此字段就指定了网卡对应的ip地址 IPV6INIT=no IPV6_AUTOCONF=no NETMASK=255.255.255.192 #网卡对应的网络掩码 NETWORK=202.100.84.170 #网卡对应的网络地址 ONBOOT=yes #系统启动时是否设置此网络接口,设置为yes时,系统启动时激活此设备 4、修改网关 [root@centos]# vi /etc/sysconfig/network 修改以下内容 NETWORKING=yes(表示系统是否使用网络,一般设置为yes。如果设为no,则不能使用网络,而且很多系统服务程序将无法启动) GATEWAY=202.100.84.129(设置本机连接的网关的IP地址。例如,网关为10.0.0.2) 5、修改DNS 修改对应网卡的DNS的配置文件 # vi /etc/resolv.conf 修改以下内容 nameserver 202.100.64.68
6、重新启动网络配置 # service network restart
提示错误,IP 202.100.84.170 无法写入。经检查,系统同时有两块网卡eth0和lo 被激活, 关掉激活lo, 重启network,一切正常。此时已能从广域网SSH服务器了。
7、网络已经配置好,下一步设置yum源,就用USTC的源吧,稳定快捷。
# vi /etc/yum.respos.d/CentOS-Base.repo
将内容改为(横线内,不包括横线):
------------------------------------------------------------
[base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
------------------------------------------------------------
保存退出。
8、升级系统。
# yum -y update
屏幕一阵跳动,Complete! 升级完毕。
9、装 Apache,PHP,MySQL 等。
#yum -y install httpd php-common php-devel php-gd php-mcrypt php-mbstring php-pear php-bcmath php-dba php-mhash php-mysql php-mxl mysql-server mysql-client gcc
一口气把需要的都安装完。
10、设置httpd、mysqld等服务开机自启动。
# /sbin/chkconfig httpd _disibledevent=>
--
--------------------------------------------------
--- PetroChina.Co., Ltd. -- 馬超
محمد

Tags: 

延伸阅读

最新评论

发表评论