您的位置:首页 > 运维架构 > Linux

CentOS 简单配置步骤

2010-03-14 19:19 471 查看
(一)YUM:

国内最快的源:http://centos.ustc.edu.cn/

我安装CentOS 5的方法:

下载centos/5.4 CentOS-5.4-i386(或x86_64)-netinstall.iso,刻盘安装CentOS5.4,安装地方设置为HTTP,Server centos.ustc.edu.cn, 目录 为centos/5.4/os/i386 或 centos/5.4/os/x86_64。

安装后请按照以下步骤修改CenOS-Base.repo,以后就可以方便的用yum安装软件了.

cd /etc/yum.repos.d

mv CentOS-Base.repo CentOS-Base.repo.save

wget http://centos.ustc.edu.cn/CentOS-Base.repo.5

mv CentOS-Base.repo.5 CentOS-Base.repo

RHEL = Red Hat Enterprise Linux

EPEL :

EPEL(http://fedoraproject.org/wiki/EPEL
) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux

等提供高质量软件包的项目。装上了 EPEL,就像在 Fedora 上一样,可以通过 yum install package-name,随意安装软件。

我们前面提到的 Func 、Cobbler 等软件都能在 EPEL Repo 中找到。

安装 EPEL 非常简单:

* RHEL 4: rpm -Uvh http://download.fedora.redhat.com/pub/epel/4/i386/epel-release-4-9.noarch.rpm

* RHEL 5: rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

安装完毕之后,即可使用 yum 来安装软件,比如 nginx

yum install nginx

(二)修改打开文件数:

在 /etc/security/limits.conf 增加:

* soft nofile 65535

* hard nofile 65535

(三)安装c/c++编译

yum install ncurses-devel (安装nload 需要次lib)

yum insall gcc gcc-c++

(四)安装nload

安装环境RHEL5 nload 0.7.2 下载路径:

http://www.roland-riegel.de/nload/index.html
(建议用IE下载)142KB

tar zxvf nload-0.7.2.tar.gz

cd nload-0.7.2

./configure

make

make install

(五)安装net-snmpd

yum instll net-snmp

编辑 /etc/snmp/snmpd.conf

删除其他,只留下这一行:

rocommunity public 121.14.117.52(cacti安装的机器的ip)

(六)配置 同步工具 rsync

[root@localhost html]# nano -w /home/zyh/rsync_client.sh

#/bin/bash

/usr/bin/rsync -auv --progress 219.134.132.75::html /data/html

(七)增加用户:

#useradd zyh -m -G users,wheel -s /bin/bash

配置sudo

#visudo

zyh ALL=(ALL) ALL

(八)设置时区和同步时钟

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

或者使用 tzselect 命令 选择时区

没安装ntp 的先安装: yum install ntpdate

yum install -y ntpdate

crontab -e

0 5 * * * /usr/sbin/ntpdate stdtime.gov.hk

(九)解决putty 中文乱码问题

如果系统语言环境设置为简体中文,使用putty 登陆后,可以有些中文看到是乱码。

这是putty和centOS的语言环境不一样导致的,可以在putty 设置跟centOS一样语言环境

解决这个问题,putty-->window-->translation-->Received data assumed to be in which character set:(选择相应的编码)。

例如:centOS:

cat /etc/sysconfig/i18n

LANG="zh_CN.UTF-8"

putty :相应选择:UTF-8

这样就可以解决中文乱码的问题

(十)修改默认语言

vi /etc/sysconfig/i18n

改成LANG=”en_US.UTF-8″

然后生效配置文件

source /etc/sysconfig/i18n

重新登陆后,发现语言环境已经变为英文

(十一)设置网卡

vi /etc/sysconfig/network-scripts/ifcfg-eth0

#service network restart

(十二)更改主机名

vi /etc/sysconfig/network

HOSTNAME=yourhostname

(十三)修改DNS,用opendns,当然也可以用机房提供的.

vi /etc/resolv.conf

nameserver 208.67.222.222

nameserver 208.67.220.220

(十四)更新常用编译工具包

yum install -y glibc* cpp gcc* openssl* make

yum update -y

(十五)关闭selinux

使用文本编辑工具打开 /etc/selinux/config
把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:SELINUX=disabled

保存,关闭。

重启系统。



开放防火墙 80端口:

通过/etc/init.d/iptables status命令查询是否有打开80端口,如果没有可通过两种方式处理:

1.修改vi /etc/sysconfig/iptables命令添加使防火墙开放80端口

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

2.关闭防火墙

/etc/init.d/iptables stop

#start 开启

#restart 重启

永久性关闭防火墙chkconfig --level 35 iptables off

(十六)

默认很多服务都是不需要的,服务越少越安全..

service acpid stop ; chkconfig acpid off

service apmd stop ; chkconfig apmd off

service atd stop ; chkconfig atd off

service auditd stop ; chkconfig auditd off

service autofs stop ; chkconfig autofs off

service avahi-daemon stop ; chkconfig avahi-daemon off

service bluetooth stop ; chkconfig bluetooth off

service cpuspeed stop ; chkconfig cpuspeed off

service cups stop ; chkconfig cups off

service firstboot stop ; chkconfig firstboot off

service gpm stop ; chkconfig gpm off

service haldaemon stop ; chkconfig haldaemon off

service hidd stop ; chkconfig hidd off

service hplip stop ; chkconfig hplip off

service ip6tables stop ; chkconfig ip6tables off

service isdn stop ; chkconfig isdn off

service lm_sensors stop ; chkconfig lm_sensors off

service mcstrans stop ; chkconfig mcstrans off

service messagebus stop ; chkconfig messagebus off

service netfs stop ; chkconfig netfs off

service nfslock stop ; chkconfig nfslock off

service pcscd stop ; chkconfig pcscd off

service portmap stop ; chkconfig portmap off

service restorecond stop ; chkconfig restorecond off

service rpcgssd stop ; chkconfig rpcgssd off

service rpcidmapd stop ; chkconfig rpcidmapd off

service yum-updatesd stop ; chkconfig yum-updatesd off

service smartd stop ; chkconfig smartd off
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: