OS安装完后,初始化系统。更新和安装部分包和epel源,禁用selinux,同步时间,设置utf-8,limits,profile的配置文件。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/bin/bash
#
# 2015/07/15
yum -y update
yum -y groupinstall
"Development Tools"
yum -y
install
lrzsz wget vim ntp
# 先同步一次时间,后续要通过局域网的ntp服务器来定时同步。
/usr/sbin/ntpdate
stdtime.gov.hk
# CentOS 用户可以直接通过 yum install epel-release 安装并启用 EPEL 源。CentOS Extras 默认包含该包。
rpm -Uvh http:
//dl
.fedoraproject.org
/pub/epel/epel-release-latest-6
.noarch.rpm
yum makecache
# 禁用selinux
# modify /etc/sysconfig/selinux
# to: SELINUX=disabled
# and reboot later.
setenforce 0 &&
sed
-i
's/SELINUX=enforcing/SELINUX=disabled/'
/etc/selinux/config
# utf-8
[ -f
/etc/sysconfig/i18n
.bak ] ||
cp
-a
/etc/sysconfig/i18n
/etc/sysconfig/i18n
.bak && \
echo
'LANG="en_US.UTF-8"'
>
/etc/sysconfig/i18n
# limits
sed
-i
's/1024/65535/'
/etc/security/limits
.d
/90-nproc
.conf
cat
<<_LIMIT >
/etc/security/limits
.d
/my-limits
.conf
* soft nofile 65535
* hard nofile 65535
* soft core unlimited
_LIMIT
# profile
cat
<<_PROFILE >>
/etc/profile
alias
ls
=
'ls --color=tty'
alias
ll=
'ls -l --color=tty'
alias
l.=
'ls -d .* --color=tty'
alias
vi
=
'vim'
alias
rm
=
'rm -i'
alias
cp
=
'cp -i'
alias
mv
=
'mv -i'
alias
grep
=
'grep --color'
alias
pgrep=
'pgrep -l'
alias
fgrep
=
'fgrep --color'
alias
which
=
'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
export
HISTTIMEFORMAT=
"%F %T "
export
HISTFILESIZE=50000
export
HISTSIZE=50000
_PROFILE
|
本文转自 pcnk 51CTO博客,原文链接:http://blog.51cto.com/nosmoking/1612941,如需转载请自行联系原作者