一、系统环境
1、设置yum源
(1)使用本地源
挂载光驱ISO文件
确认路径/media/CentOS_6.5_Final/
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
vi CentOS-Base.repo
[base]
name=Base
baseurl=file:///media/CentOS_6.5_Final/
gpgcheck=0
#(1检测 0不检测)
enabled=1
#(1启动 0不启动)
(2)使用163的源
cd /etc/yum.repos.d
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS-Base.repo CentOS-Base.repo.bak2
mv CentOS6-Base-163.repo CentOS-Base.repo
(3)更新列表
yum clean all
yum list
2、安装图形界面
查看是否安装了桌面环境的组件
yum grouplist | more
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"
vi /etc/inittab
修改启级别为5
reboot重新启动
3、设置并启用网卡
ifconfig -a
vi /etc/sysconfig/network-scripts/ifcfg-eth0
设置网卡静态IP地址,自动启动为ON
ifup eth0
echo "nameserver 202.101.224.68">> /etc/resolv.conf
4、配置VNC远程桌面
yum install -y tigervnc-server
vncserver :1
密码123456
vi /root/.vnc/xstartup
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
#twm&
gnome-session
vncserver -kill :1
vncserver :1
设置自动启动
vi /etc/sysconfig/vncservers
VNCSERVERS="1:user1"
VNCSERVERARGS[1]="-geometry 800x600 -alwaysshared "
chkconfig vncserver on
5、关闭selinux
vi /etc/selinux/config
SELINUX=disabled
重启服务器即可
不想重启可执行setenforce 0
6、ntpupdate同步时间
crontab -e
10 * * * * /usr/sbin/ntpdate -s 65.55.56.206
service crond restart
ntpdate 65.55.56.206
7、setup自启动项
配置系统自动启动项
httpd mysqld snmpd nagios vncserver network
8、FTP文件传输
yum install -y vsftpd
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO #禁止匿名访问
userlist_deny=NO #(手动添加)使用FTP用户表
useradd ywzhou
passwd ywzhou
123456
vi /etc/vsftpd/user_list
ywzhou
/etc/init.d/vsftpd start
chkconfig vsftpd on
9、防火墙
iptables -I INPUT -p tcp --dports 21,80,5901 -j ACCEPT
service iptables save
或者
vi /etc/sysconfig/iptables
-A INPUT -p tcp --dport 21 -j ACCEPT
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 5901 -j ACCEPT
service iptables restart
二、编译环境
1、安装gcc
yum install gcc
2、安装glibc
yum install glibc glibc-common
3、安装gd
yum install gd gd-devel
4、安装pcap
yum install libtool libpcap libpcap-devel gdbm gdbm-devel zlib zlib-devel
注意:使用本地YUM源安装时,个别包没有,需要更换为163源在线安装。
二、LAMP环境
1、安装apache
yum install -y httpd
vi /etc/httpd/conf/httpd.conf
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
service httpd start
chkconfig httpd on
vi /etc/sysconfig/iptables
-A INPUT -p tcp --dport 80 -j ACCEPT
service iptables restart
2、安装php
yum install -y php php-mysql php-devel php-snmp php-gd
vim /var/www/html/index.php
<?php phpinfo(); ?>
http://localhost
3、安装mysql
yum install -y mysql mysql-server mysql-devel
service mysqld start
chkconfig mysqld on
mysqladmin -u root password ‘123456‘
断电导致mysqld无法启动问题:
service mysql restart
Another MySQL daemon already running with the same unix socket
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
service mysqld restart
本文出自 “月晴星飞” 博客,请务必保留此出处http://ywzhou.blog.51cto.com/2785388/1531480
Cacti+Nagios监控系统(一):准备工作,布布扣,bubuko.com
原文地址:http://ywzhou.blog.51cto.com/2785388/1531480