安装—— CentOS 5 服务器 Nginx 环境推荐教程 一、系统约定 软件源代码包存放位置/usr/local/src 源码包编译安装位置(prefix) /usr/local/software_name 脚本以及维护程序存放位置/usr/local/sbin MySQL 数据库位置/var/lib/mysql(可按情况设置) 网站根目录/home/) 虚拟主机日志根目录/home/) 运行账户 二、系统环境部署及调整 1、检查系统是否正常 # more /var/log/messages (检查有无系统级错误信息) # dmesg (检查硬件设备是否有错误信息) # ifconfig(检查网卡设置是否正确) # ping (检查网络是否正常) # cat /proc/cpuinfo (检查 CPU 频率是否正常) # top (按 1 检测 CPU 核数是否正常,内存大小是否正常) 2、关闭不需要的服务 # ntsysv 以下仅列出需要启动的服务,未列出的服务一律推荐关闭: atd crond irqbalance microcode_ctl network sendmail sshd syslog 关闭 SElinux:修改/etc/selinux/config 文件中的 SELINUX= 为 disabled 3、更换 yum 国内源 # cd /etc/ # mv CentOS- CentOS- # wget ./CentOS- # mv CentOS- CentOS- # yum clean all 注意:如果 ./CentOS- 没有的话,直 接拷贝以下文本保存为 CentOS- 放到/etc/ # CentOS- # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base - baseurl=http://mirrors./centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist./?release=$releasever&arch=$base arch&repo=os gpgcheck=1 gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates - baseurl=http://mirrors./centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist./?release=$releasever&arch=$base arch&repo=updates gpgcheck=1 gpgkey=http://mirror./centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons - baseurl=htt