安裝CentOS系統,配置系統的網絡環境
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=192.168.126.5 NETMASK=255.255.255.0 GATWAY=192.168.126.2
vi /etc/resolv.conf
nameserver 192.168.126.2
如果是虛擬機,則配置的是網關地址
vi /etc/sysconfig/network
NETWORKING=yes HOSTNAME=yum GATEWAY=192.168.126.2
service network restart
安裝nginx服務
yum install nginx
如果下載失敗或沒有找到源,可通過更新第三方源來安裝
chkconfig nginx on
vi /etc/nginx/nginx.conf
在http{裡面增加如下內容:
autoindex on; #開啟nginx目錄浏覽功能 autoindex_exact_size off; #文件大小從KB開始顯示 autoindex_localtime on; #顯示文件修改時間為服務器本地時間
http://192.168.126.5
准備yun源數據
mount /dev/cdrom /mnt/
mkdir /usr/share/nginx/html/yum
cp –rf /mnt/* /usr/share/nginx/html/yum/
http://192.168.126.5/yum
更新yum源信息
vi /etc/yum.repos.d/LocalServer.repo
[local] name = CentOS / localserver baseurl=http://192.168.126.5/yum/ enabled = 1 gpgkey = http://192.168.126.5/yum/RPM-GPG-KEY-CentOS-6 gpgcheck = 1
vi CentOS-Base.repo
添加 enabled=0
yum check-update
yum repolist
http://xxxxxx/Linuxjc/1141592.html TechArticle