1.不要なサービスの停止

記事公開日:2015年01月08日
最終更新日:2017年06月13日

不要なサービスを停止

chkconfigでOS起動時に自動起動するサービスの設定、確認ができます。
とりあえず、ざくっとoffにしました。

chkconfig abrt-ccpp off
chkconfig abrt-oops off
chkconfig abrtd off
chkconfig acpid off
chkconfig atd off
chkconfig auditd off
chkconfig blk-availability off
chkconfig cpuspeed off
chkconfig haldaemon off
chkconfig ip6tables off
chkconfig iptables off
chkconfig irqbalance off
chkconfig iscsi off
chkconfig iscsid off
chkconfig lvm2-monitor off
chkconfig mdmonitor off
chkconfig messagebus off
chkconfig netfs off
chkconfig sysstat off
chkconfig udev-post off

※↓2015年01月21日 更新 自動バグ報告ツールのサービスを有効化することに変更

#自動バグ報告ツールのサービスを有効化
chkconfig abrt-ccpp on
chkconfig abrt-oops on
chkconfig abrtd on

実行後、以下のコマンドでon になっているサービスを確認します。

chkconfig --list | awk '{printf "%s\t\t%s\n", $1,$5}' | grep 3:on
crond           3:on
network         3:on
postfix         3:on
rsyslog         3:on
sshd            3:on

上記の5つのサービスだけ有効になっています。

SELinux無効化にして再起動

vi /etc/sysconfig/selinux
SELINUX=disabled ←enforcingを変更!

保存後、rebootで再起動します。

vimの設定

viコマンドを実行時にvimが起動するように設定します。

vi /etc/bashrc
alias vi='vim'

これでviコマンドでvimが起動します。
7-centos-1

vi ~/.vimrc

以下の値を貼り付けて保存します。

set nocompatible
set fileformats=unix,dos,mac

set history=100
set ignorecase
set smartcase
set wrapscan
set incsearch
set title
set number
set laststatus=2
set statusline=%F%m%r%h%w\%=[TYPE=%Y]\[FORMAT=%{&ff}]\[文字コード=%{&fileencoding}]\[ASCII=\%03.3b]\ [HEX=\%02.2B]\[%04l行,%04v桁][%p%%]\ [LEN=%L]
 
if &encoding !=# 'utf-8'
  set encoding=japan
  set fileencoding=japan
endif
if has('iconv')
  let s:enc_euc = 'euc-jp'
  let s:enc_jis = 'iso-2022-jp'
  if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb"
	let s:enc_euc = 'eucjp-ms'
	let s:enc_jis = 'iso-2022-jp-3'
  elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb"
	let s:enc_euc = 'euc-jisx0213'
	let s:enc_jis = 'iso-2022-jp-3'
  endif
  if &encoding ==# 'utf-8'
	let s:fileencodings_default = &fileencodings
	let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932'
	let &fileencodings = &fileencodings .','. s:fileencodings_default
	unlet s:fileencodings_default
  else
	let &fileencodings = &fileencodings .','. s:enc_jis
	set fileencodings+=utf-8,ucs-2le,ucs-2
	if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$'
  	set fileencodings+=cp932
  	set fileencodings-=euc-jp
  	set fileencodings-=euc-jisx0213
  	set fileencodings-=eucjp-ms
  	let &encoding = s:enc_euc
  	let &fileencoding = s:enc_euc
    else
  	let &fileencodings = &fileencodings .','. s:enc_euc
	endif
  endif
  unlet s:enc_euc
  unlet s:enc_jis
endif
if has('autocmd')
  function! AU_ReCheck_FENC()
	if &fileencoding =~# 'iso-2022-jp' && search("[^\x01-\x7e]", 'n') == 0
  	let &fileencoding=&encoding
	endif
  endfunction
  autocmd BufReadPost * call AU_ReCheck_FENC()
endif
set fileformats=unix,dos,mac
if exists('&ambiwidth')
  set ambiwidth=double
endif

時刻同期の設定

OSの時刻が自動で同期されるようにntpの設定をします。
元の設定ファイルをバックアップし、新規に設定ファイルを作成します。

mv /etc/ntp.conf /etc/ntp.conf.org
vi /etc/ntp.conf
driftfile /var/lib/ntp/drift
server ntp1.jst.mfeed.ad.jp
server ntp2.jst.mfeed.ad.jp
server ntp3.jst.mfeed.ad.jp

サービスを起動して、自動起動を登録します。ntpqコマンドで同期確認をします。

/etc/rc.d/init.d/ntpd start
chkconfig ntpd on
ntpq -p
スポンサーリンク

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

←← 7.CentOSの設定
→→ 2.VirtualBox Guest Additionsをインストール