Chinaunix首页 | 论坛 | 博客
  • 博客访问: 11850
  • 博文数量: 4
  • 博客积分: 115
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-13 00:37
文章分类
文章存档

2012年(4)

我的朋友
最近访客

分类: 系统运维

2012-09-21 16:56:02

摘要:  CentOS  初始化设置 +基本web环境配置,yum方式

#############  第一部分 上线之前 基本环境检查,配置  ################### 

######### LAMP 环境安装之前的基本设置、校准操作######################

####### 1 配置、校准部分

# data 

###### 如时间显示不对,时区不对

# cp -f /usr/share/zoneinfo/Asia/Shanghai    /etc/localtime

 ########校准系统时间,写入硬件时钟芯片 ###########

#######  2.启用 ntp服务同步时间

# yum -y install  ntp

# ntpdate us.pool.ntp.org

#chkconfig   ntpd on

#hwclock  --systohc

## or  clock -w 

######### 3. 加入监控

# yum install net-snmpd

# chkconfig  snmpd on

# vi /etc/snmp/snmpd.conf

######## 加入监控服务器IP  ###########################

############ 替换以下内容即可#########################

# First, map the community name "public" into a "security name"

#       sec.name  source          community

com2sec notConfigUser   123.456.0.1  server_ID  

# Second, map the security name into a group name:

#       groupName      securityModel securityName

group   notConfigGroup v1           notConfigUser

group   notConfigGroup v2c           notConfigUser

####

# Finally, grant the group read-only access to the systemview view.

#       group          context sec.model sec.level prefix read   write  notif

access  notConfigGroup ""      any       noauth    exact  all     none none

##           incl/excl subtree                          mask

view all    included  .1                               80

######################  end of  snmpd.conf #####################

#######  4  全更新 

######### 默认CentOS yum源来升级版本

 #  yum update  -y

 ######  5. 关闭服务 不需要的服务

 ###  setup  --- > system service

#Or  

### 1/  chkconfig  –level  345 bluetooth off

### 2/  chkconfig  --level  345 dund off

### 3/  chkconfig  --level  345  cups/ cupspeed  off

### 4/  chkconfig  --level  345  firstboot  off

### 5/  chkconfig  --level  345  isdn   off

###########  没连 isci 存储设置的话,可关

### 6/  chkconfig  --level  345  iscsi   off

### 7/  chkconfig  --level  345  iscsid   off

### 8/  chkconfig  --level  345  pcscd   off

### 9/  chkconfig  --level  345  portmap   off

###########  如无 nfs 网络服务,关闭 nfsclock

### 10/  chkconfig  --level  345  nfscolck   off

### 11/  chkconfig  --level  345  sendmail   off

### 12/  chkconfig  --level  345  iptables   off

### 13/  chkconfig  --level  345  ip6tables   off

### 14 /  chkconfig  --level  345   named   off

### 方便调试 关闭 iptables

##  /etc/init.d/iptables  stop


#######根据实际情况 卸载 web无关的服务和包

## yum groupremove "Mail Server"

## yum groupremove   "Dialup Networking Support"


######  7. 设置  ssh port #############################

##  vi /etc/ssh/sshd_config

##   PORT  22―――>改为非 22端口 如 9991

########  8.  根据实际情况 关闭 SELinux ################

###  vi  /etc/selinux/config

SELINUX=disabled

### 需要 重启OS后生效

########### 9 . 如为负载环境,加上 本地loopback IP绑定 #################

 

#### 换回地址 lo :0 上绑定 vip 123.123.1.232

vi /etc/sysconfig/network-scripts/ifcfg-lo:0

IPADDR=  123.123.1.232    ### 此处写入负载的虚拟IP

NETMASK=255.255.255.255

# If you're having problems with gated making 127.0.0.0/8 a martian,

# you can change this to something else (255.255.255.255, for example)

ONBOOT=yes

NAME=loopback

 

#####################  负载的web  server 127 128

# vi /etc/sysctl.conf

# sysctl.conf加入 net.ipv4.conf.eth0.arp_ignore = 1

# net.ipv4.conf.eth0.arp_announce = 2

#sysctl  -p  生效下

 

# service network restart

#### 重启下网络服务生效 #

####  检查下 ip 是否绑定

#####  ifconfig  |grep addr




阅读(434) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~