您好,登錄后才能下訂單哦!
系統版本:CentOS-6.5-x86_64
一、系統環境
1、主機名
[root@nagios ~]# hostname nagios.ewin.com [root@nagios ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=nagios.ewin.com
2、yum源
(1)使用本地源
掛載光盤或ISO文件并配置源:
[root@nagios ~]# mkdir /media/cdrom [root@nagios ~]# mount /dev/cdrom /media/cdrom/ [root@nagios ~]# cd /etc/yum.repos.d [root@nagios yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak [root@nagios yum.repos.d]# vi CentOS-Base.repo [base] name=Base baseurl=file:///media/cdrom/ gpgcheck=0 enabled=1
(2)添加163的源
[root@nagios yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
(3)更新列表
[root@nagios yum.repos.d]# yum clean all [root@nagios yum.repos.d]# yum list
(4)解除鎖定狀態
使用yum安裝時可能會出現鎖定狀態,報錯如下:
Another app is currently holding the yum lock; waiting for it to exit...
解決方法:
[root@nagios ~]# rm -f /var/run/yum.pid
3、X桌面環境
查看是否安裝了桌面環境的組件,沒有則進行組安裝:
[root@nagios ~]# yum grouplist | more [root@nagios ~]# yum groupinstall -y "Desktop" "Desktop Platform" "Desktop Platform Development" "Fonts" "General Purpose Desktop" "Graphical Administration Tools" "Graphics Creation Tools" "Input Methods" "X Window System" "Chinese Support [zh]" "Internet Browser"
修改啟動級別為5后重啟服務器:
[root@nagios ~]# vi /etc/inittab id:5:initdefault: [root@nagios ~]# reboot
4、網卡配置
查看網絡配置:
[root@nagios ~]# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:15:5D:01:2C:00 inet addr:10.188.1.103 Bcast:10.188.1.255 Mask:255.255.255.0 inet6 addr: fe80::215:5dff:fe01:2c00/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:20570650 errors:0 dropped:0 overruns:0 frame:0 TX packets:23909757 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1997534214 (1.8 GiB) TX bytes:1952904919 (1.8 GiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1691114 errors:0 dropped:0 overruns:0 frame:0 TX packets:1691114 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:96615865 (92.1 MiB) TX bytes:96615865 (92.1 MiB)
手動設置網卡:
[root@nagios ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 #接口名稱 TYPE=Ethernet #接口類型:以太網 ONBOOT=yes #開機啟動 BOOTPROTO=static #靜態IP HWADDR=00:15:5D:01:2C:00 #MAC地址 IPADDR=10.188.1.103 #IP地址 PREFIX=24 #子網掩碼位數,或使用NETMASK=255.255.255.0 GATEWAY=10.188.1.1 #網關地址 DNS1=10.188.1.2 #DNS服務器地址,我這是內網的DNS DNS2=202.101.224.68 #公網DNS服務器地址
重啟網卡:
[root@nagios ~]# ifdown eth0 && ifup eth0
5、vnc遠程桌面
安裝及啟動進程1(端口號是5900+1):
[root@nagios ~]# yum install -y tigervnc-server [root@nagios ~]# vncserver :1 #輸入密碼123456
配置啟動腳本,使用Gnome會話模式:
[root@nagios ~]# vi /root/.vnc/xstartup unset SESSION_MANAGER exec /etc/X11/xinit/xinitrc #twm& gnome-session
重啟vnc進程:
[root@nagios ~]# vncserver -kill :1 [root@nagios ~]# vncserver :1
設置開機自動啟動:
[root@nagios ~]# vi /etc/sysconfig/vncservers VNCSERVERS="1:root" VNCSERVERARGS[1]="-geometry 800x600 -alwaysshared " [root@nagios ~]# chkconfig vncserver on
6、selinux安全項
[root@nagios ~]# vi /etc/selinux/config SELINUX=disabled [root@nagios ~]# setenforce 0
7、ntpupdate時間同步
[root@nagios ~]# crontab -e 0 * * * * /usr/sbin/ntpdate 65.55.56.206 #1小時同步一次 [root@nagios ~]# service crond restart [root@nagios ~]# ntpdate 65.55.56.206 18 Nov 10:07:49 ntpdate[8567]: step time server 65.55.56.206 offset -0.743765 sec
8、FTP文件傳輸
[root@nagios ~]# yum install -y vsftpd [root@nagios ~]# vi /etc/vsftpd/vsftpd.conf anonymous_enable=NO #禁止匿名訪問 userlist_deny=NO #(手動添加)使用FTP用戶表 [root@nagios ~]# useradd ywzhou [root@nagios ~]# passwd ywzhou #輸入密碼123456 [root@nagios ~]# vi /etc/vsftpd/user_list ywzhou [root@nagios ~]# /etc/init.d/vsftpd start [root@nagios ~]# chkconfig vsftpd on
9、防火墻
[root@nagios ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT [root@nagios ~]# iptables -I INPUT -p tcp --dport 21 -j ACCEPT [root@nagios ~]# iptables -I INPUT -p tcp --dport 5901 -j ACCEPT [root@nagios ~]# service iptables save
二、LAMP環境
1、安裝Apache
[root@nagios ~]# yum install -y httpd [root@nagios ~]# vi /etc/httpd/conf/httpd.conf DirectoryIndex index.php index.html AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps [root@nagios ~]# service httpd start [root@nagios ~]# chkconfig httpd on
2、安裝PHP
[root@nagios ~]# yum -y install php php-devel php-snmp php-gd php-mysql
訪問測試:
[root@nagios ~]# vi /var/www/html/index.php <?php phpinfo(); ?>
http://localhost
結論:會顯示php的相關信息表示php+apache整合成功
3、安裝Mysql
[root@nagios ~]# yum install mysql mysql-server mysql-devel [root@nagios ~]# service mysqld start [root@nagios ~]# chkconfig mysqld on [root@nagios ~]# mysqladmin -u root password '123456'
當主機斷電重啟后zabbix無法連接mysql,報錯如下:
Another MySQL daemon already running with the same unix socket
要先刪除mysql.sock文件才能啟動mysqld,因此在執行下面的命令開機重啟mysql:
[root@nagios ~]# echo "rm -f /var/lib/mysql/mysql.sock && service mysqld restart" >> /etc/rc.local
三、編譯環境
1、安裝gcc
[root@nagios ~]# yum install gcc
2、安裝glibc
[root@nagios ~]# yum install glibc glibc-common
3、安裝gd
[root@nagios ~]# yum install gd gd-devel
4、安裝pcap
[root@nagios ~]# yum install libtool libpcap libpcap-devel gdbm gdbm-devel zlib zlib-devel
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。