| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

「CentOS 初期設定」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
1行目: 1行目:
==CentOS 初期設定==
+
==[[CentOS 初期設定]]==
 
[[CentOS]] | [[Linux]] | [[Fedora]] | [[CentOS7]] |  
 
[[CentOS]] | [[Linux]] | [[Fedora]] | [[CentOS7]] |  
 
*初期設定する手順をまとめておく
 
*初期設定する手順をまとめておく
6行目: 6行目:
 
===バージョンの確認===
 
===バージョンの確認===
 
  # cat /etc/*release                                                                             
 
  # cat /etc/*release                                                                             
  CentOS release 6.2 (Final)
+
  [[CentOS]] release 6.2 (Final)
  CentOS release 6.2 (Final)
+
  [[CentOS]] release 6.2 (Final)
  CentOS release 6.2 (Final)
+
  [[CentOS]] release 6.2 (Final)
  
 
===ネットワークインストール===
 
===ネットワークインストール===
15行目: 15行目:
 
=====ネットワークインストール用 bootイメージ=====
 
=====ネットワークインストール用 bootイメージ=====
 
*以下から探す
 
*以下から探す
**ftp://ftp.riken.jp/Linux/centos/
+
**ftp://ftp.riken.jp/[[Linux]]/centos/
 
*例 6.2
 
*例 6.2
**ftp://ftp.riken.jp/Linux/centos/6.2/isos/i386/CentOS-6.0-i386-netinstall.iso
+
**ftp://ftp.riken.jp/Linux/centos/6.2/isos/i386/[[CentOS]]-6.0-i386-netinstall.iso
 
=====FTPインストール指定先=====
 
=====FTPインストール指定先=====
 
*以下から探す
 
*以下から探す
**ftp://ftp.riken.jp/Linux/centos/
+
**ftp://ftp.riken.jp/[[Linux]]/centos/
 
*例 6.2
 
*例 6.2
**ftp://ftp.riken.jp/Linux/centos/6.2/os/i386/
+
**ftp://ftp.riken.jp/[[Linux]]/centos/6.2/os/i386/
  
 
===[http://typea.info/blg/glob/cat5/ Xen ゲストOSとしてインストール]===
 
===[http://typea.info/blg/glob/cat5/ Xen ゲストOSとしてインストール]===
*Fedora Core 6 Xen のインストール
+
*[[Fedora Core 6 Xen のインストール]]
 
*[http://typea.info/blg/glob/cat5/ Xen ゲストOSとしてインストール]
 
*[http://typea.info/blg/glob/cat5/ Xen ゲストOSとしてインストール]
 
===日本語環境の設定===
 
===日本語環境の設定===
 
====日本語サポートのインストール====
 
====日本語サポートのインストール====
 
  # yum groupinstall install "Japanese Support"
 
  # yum groupinstall install "Japanese Support"
  # vi /etc/sysconfig/i18n
+
  # [[vi]] /etc/sysconfig/i18n
 
   LANG="ja_JP.UTF-8"
 
   LANG="ja_JP.UTF-8"
  
50行目: 50行目:
 
         User            root
 
         User            root
 
         Port            3843
 
         Port            3843
====Cygwinでconfigファイルを利用するには以下の手順が必要====
+
====[[Cygwin]]でconfigファイルを利用するには以下の手順が必要====
 
  $ chgrp Users config
 
  $ chgrp Users config
 
  $ chmod 600 config
 
  $ chmod 600 config
  
====Cygwinで公開鍵を使う場合以下の手順が必要====
+
====[[Cygwin]]で公開鍵を使う場合以下の手順が必要====
 
  chgrp Users ~/.ssh/id_rsa
 
  chgrp Users ~/.ssh/id_rsa
 
  chmod 600 ~/.ssh/id_rsa
 
  chmod 600 ~/.ssh/id_rsa
  
 
===ネットワーク設定===
 
===ネットワーク設定===
====[Linux ネットワーク設定 ifconfig] [IPアドレスの設定]====
+
====[[Linux ネットワーク設定 ifconfig|IPアドレスの設定]]====
 
===VNCを使えるようにする。===
 
===VNCを使えるようにする。===
 
*GUIを使えると便利な局面も多いので、まずVNCを使えるようにしておく
 
*GUIを使えると便利な局面も多いので、まずVNCを使えるようにしておく
*[Fedora Core 6 ファイヤーウォールの設定] [Fedoraと同様]まず、コマンドから、5901ポートを開けて、VNCサーバーを使えるようにする。
+
*[[Fedora Core 6 ファイヤーウォールの設定|Fedoraと同様]]まず、コマンドから、5901ポートを開けて、VNCサーバーを使えるようにする。
  
====CentOS 7====
+
====[[CentOS]] 7====
 
<blockquote>以下の手順ではサービスがACTIVEにならず</blockquote>
 
<blockquote>以下の手順ではサービスがACTIVEにならず</blockquote>
 
=====install=====
 
=====install=====
70行目: 70行目:
 
=====設定編集=====
 
=====設定編集=====
 
  # cat /etc/sysconfig/vncservers  
 
  # cat /etc/sysconfig/vncservers  
  # THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.service
+
  # THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.ser[[vi]]ce
  
*Copy this file to /etc/systemd/system/vncserver@:<display>.service
+
*Copy this file to /etc/systemd/system/vncserver@:<display>.ser[[vi]]ce
  # cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service            
+
  # cp /lib/systemd/system/vncserver@.ser[[vi]]ce /etc/systemd/system/vncserver@:1.ser[[vi]]ce            
  
 
*Edit <USER> and vncserver parameters appropriately ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2") [Service]
 
*Edit <USER> and vncserver parameters appropriately ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2") [Service]
 
  Type=forking
 
  Type=forking
  # Clean any existing files in /tmp/.X11-unix environment
+
  # Clean any existing files in /tmp/.X11-unix en[[vi]]ronment
 
  ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
 
  ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
 
  ExecStart=/sbin/runuser -l piroto -c "/usr/bin/vncserver -geometry 1024x768 -nolisten tcp -localhost"                                                       
 
  ExecStart=/sbin/runuser -l piroto -c "/usr/bin/vncserver -geometry 1024x768 -nolisten tcp -localhost"                                                       
88行目: 88行目:
 
  Verify:
 
  Verify:
  
*Run `systemctl daemon-reload`
+
*[[R]]un `systemctl daemon-reload`
 
  # systemctl daemon-reload  
 
  # systemctl daemon-reload  
*Run `systemctl enable vncserver@:<display>.service`
+
*Run `systemctl enable vncserver@:<display>.ser[[vi]]ce`
  # systemctl enable vncserver@:1.service
+
  # systemctl enable vncserver@:1.ser[[vi]]ce
ln -s '/etc/systemd/system/vncserver@:1.service' '/etc/systemd/system/multi-user.target.wants/vncserver@:1.service'
+
ln -s '/etc/systemd/system/vncserver@:1.ser[[vi]]ce' '/etc/systemd/system/multi-user.target.wants/vncserver@:1.ser[[vi]]ce'
 
====Firewall====
 
====Firewall====
 
  # firewall-cmd --permanent --zone=public --add-port=5900-5910/tcp
 
  # firewall-cmd --permanent --zone=public --add-port=5900-5910/tcp
98行目: 98行目:
 
  # firewall-cmd --reload
 
  # firewall-cmd --reload
 
  success
 
  success
====CentOS 6====
+
====[[CentOS]] 6====
 
=====install=====
 
=====install=====
 
  # yum install tigervnc-server
 
  # yum install tigervnc-server
 
=====設定編集(pirotoはユーザー名)=====
 
=====設定編集(pirotoはユーザー名)=====
  #  vi /etc/sysconfig/vncservers
+
  #  [[vi]] /etc/sysconfig/vncservers
 
       :
 
       :
  VNCSERVERS="1:piroto"
+
  VNCSE[[R]]VE[[R]]S="1:piroto"
 
  VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -localhost"
 
  VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -localhost"
  
====Chain(RH-Firewall-1-INPUT) および、インデックス(10) は iptables -L で確認し、適宜値を変える====
+
====Chain([[R]]H-Firewall-1-INPUT) および、インデックス(10) は iptables -L で確認し、適宜値を変える====
  # iptables -I RH-Firewall-1-INPUT 10 -m state --state NEW -p tcp --dport 5901 -j ACCEPT
+
  # iptables -I [[R]]H-Firewall-1-INPUT 10 -m state --state NEW -p tcp --dport 5901 -j ACCEPT
  
 
*8は挿入位置、5900:5910 はポート範囲
 
*8は挿入位置、5900:5910 はポート範囲
114行目: 114行目:
 
  # iptables -I INPUT 8 -p tcp --dport 5900:5910 -j ACCEPT           
 
  # iptables -I INPUT 8 -p tcp --dport 5900:5910 -j ACCEPT           
 
====保存と再起動====
 
====保存と再起動====
  # service iptables save
+
  # ser[[vi]]ce iptables save
  # service iptables restart
+
  # ser[[vi]]ce iptables restart
 
====確認====
 
====確認====
 
  # iptables -L
 
  # iptables -L
 
     :  
 
     :  
  Chain RH-Firewall-1-INPUT (2 references)
+
  Chain [[R]]H-Firewall-1-INPUT (2 references)
 
     :  
 
     :  
  ACCEPT    all  --  anywhere            anywhere            state RELATED,ESTABLISHED  
+
  ACCEPT    all  --  anywhere            anywhere            state [[R]]ELATED,ESTABLISHED  
 
  ACCEPT    tcp  --  anywhere            anywhere            state NEW tcp dpt:ssh  
 
  ACCEPT    tcp  --  anywhere            anywhere            state NEW tcp dpt:ssh  
 
  ACCEPT    tcp  --  anywhere            anywhere            state NEW tcp dpt:5901  
 
  ACCEPT    tcp  --  anywhere            anywhere            state NEW tcp dpt:5901  
  REJECT     all  --  anywhere            anywhere            reject-with icmp-host-prohibited  
+
  [[R]]EJECT     all  --  anywhere            anywhere            reject-with icmp-host-prohibited  
 
===VNCサーバーの起動===
 
===VNCサーバーの起動===
[[Fedora Core 6 VNCの設定]] | [[Fedora同様の処理]] |
+
[[Fedora Core 6 VNCの設定|Fedora同様の処理]]
 
====Twn 以外のウィンドウマネージャーを使えるように switchdesk をインストール====
 
====Twn 以外のウィンドウマネージャーを使えるように switchdesk をインストール====
 
  # yum install switchdesk
 
  # yum install switchdesk
 
====VNCサーバーの設定を置き換え====
 
====VNCサーバーの設定を置き換え====
 
  # switchdesk gnome
 
  # switchdesk gnome
  Red Hat Linux switchdesk 4.0
+
  Red Hat [[Linux]] switchdesk 4.0
  Copyright (C) 1999-2004 Red Hat, Inc
+
  Copyright (C) 1999-2004 [[R]]ed Hat, Inc
  Redistributable under the terms of the GNU General Public License
+
  [[R]]edistributable under the terms of the GNU General Public License
 
  Desktop now set up to run GNOME.
 
  Desktop now set up to run GNOME.
 
  # cd /root/.vnc
 
  # cd /root/.vnc
161行目: 161行目:
 
*/etc/sysconfig/vncservers を編集
 
*/etc/sysconfig/vncservers を編集
 
*以下をコメントイン  
 
*以下をコメントイン  
  VNCSERVERS="1:piroto"                                                                                             
+
  VNCSE[[R]]VE[[R]]S="1:piroto"                                                                                             
 
  VNCSERVERARGS[2]="-geometry 1366x768 -nolisten tcp -localhost"
 
  VNCSERVERARGS[2]="-geometry 1366x768 -nolisten tcp -localhost"
 
*サービスの設定
 
*サービスの設定
  # chkconfig --level 3 vncserver on   
+
  # [[chkconfig]] --level 3 vncserver on   
===SELinux の設定===
+
===SE[[Linux]] の設定===
  
====SELinux の無効化====
+
====SE[[Linux]] の無効化====
 
=====確認=====
 
=====確認=====
 
*有効
 
*有効
178行目: 178行目:
 
  [root@susanoo vsftpd]# setenforce 0
 
  [root@susanoo vsftpd]# setenforce 0
 
=====設定ファイル編集=====
 
=====設定ファイル編集=====
  # vi /etc/selinux/config
+
  # [[vi]] /etc/selinux/config
 
*SELINUX=enforcing → disabled に変更
 
*SELINUX=enforcing → disabled に変更
 
  #chroot_list_file=/etc/vsftpd/chroot_list
 
  #chroot_list_file=/etc/vsftpd/chroot_list
  # This file controls the state of SELinux on the system.
+
  # This file controls the state of SE[[Linux]] on the system.
 
  # SELINUX= can take one of these three values:
 
  # SELINUX= can take one of these three values:
  #    enforcing - SELinux security policy is enforced.
+
  #    enforcing - SE[[Linux]] security policy is enforced.
  #    permissive - SELinux prints warnings instead of enforcing.
+
  #    permissive - SE[[Linux]] prints warnings instead of enforcing.
  #    disabled - No SELinux policy is loaded.
+
  #    disabled - No SE[[Linux]] policy is loaded.
 
  SELINUX=disabled
 
  SELINUX=disabled
  
=====SELinuxコンテキスト=====
+
=====SE[[Linux]]コンテキスト=====
*ls-al したときに、末尾にピリオドがついているものは、SELinuxコンテキストが付与されている
+
*ls-al したときに、末尾にピリオドがついているものは、SE[[Linux]]コンテキストが付与されている
 
  drwxr-xr-x.  8 root  root    4096  8月 16 19:46 2013 repo
 
  drwxr-xr-x.  8 root  root    4096  8月 16 19:46 2013 repo
 
*-Zで内容を確認できる
 
*-Zで内容を確認できる
204行目: 204行目:
 
各チェイン毎のルールのどれにもマッチしない場合は、そのチェインに定義されている「policy」の内容により、パケットを処理します。
 
各チェイン毎のルールのどれにもマッチしない場合は、そのチェインに定義されている「policy」の内容により、パケットを処理します。
 
*Chain INPUT (policy ACCEPT):サーバーに入ってくるパケットのうち、設定したどのルールにもマッチしない場合は、パケットを通過させる。
 
*Chain INPUT (policy ACCEPT):サーバーに入ってくるパケットのうち、設定したどのルールにもマッチしない場合は、パケットを通過させる。
*Chain OUTPUT (policy DROP):サーバーから出て行くパケットのうち、設定したどのルールにもマッチしない場合は、パケットを破棄する。
+
*Chain OUTPUT (policy D[[R]]OP):サーバーから出て行くパケットのうち、設定したどのルールにもマッチしない場合は、パケットを破棄する。
 
=====target=====
 
=====target=====
 
*ルールに該当するパケットの処理方法
 
*ルールに該当するパケットの処理方法
 
*ACCEPT:パケットを通過させる
 
*ACCEPT:パケットを通過させる
*DROP:パケットを破棄する
+
*D[[R]]OP:パケットを破棄する
 
=====prot=====
 
=====prot=====
 
プロトコル名
 
プロトコル名
280行目: 280行目:
 
|パケットの通過を許可
 
|パケットの通過を許可
 
|-
 
|-
|DROP
+
|D[[R]]OP
 
|通過しようとするパケットの破棄
 
|通過しようとするパケットの破棄
 
|-
 
|-
286行目: 286行目:
 
|ログの取得
 
|ログの取得
 
|-
 
|-
|REJECT
+
|[[R]]EJECT
 
|パケットを拒否し、ICMPメッセージを返信
 
|パケットを拒否し、ICMPメッセージを返信
 
|-
 
|-
 
|}
 
|}
  
=====バックアップ=====
+
=====[[バックアップ]]=====
 
  # cd /etc/sysconfig
 
  # cd /etc/sysconfig
 
  # cp iptables iptables.old  
 
  # cp iptables iptables.old  
315行目: 315行目:
  
 
===FTPサーバー===
 
===FTPサーバー===
*[Fedora Core 6 FTP サーバの構築] [Fedora同様]
+
*[[Fedora Core 6 FTP サーバの構築|Fedora同様]]
  
 
====インストールされているか確認====
 
====インストールされているか確認====
348行目: 348行目:
  
 
*ユーザーを追加して、パスワードを設定して、root グループに所属させる(任意)
 
*ユーザーを追加して、パスワードを設定して、root グループに所属させる(任意)
*Linux ユーザ管理
+
*[[Linux ユーザ管理]]
 
  # useradd xxxx
 
  # useradd xxxx
 
  # passwd xxxx
 
  # passwd xxxx
 
  # gpasswd -a xxx root
 
  # gpasswd -a xxx root
 
====CentOs6 ランレベル 3 で自動起動するように====
 
====CentOs6 ランレベル 3 で自動起動するように====
*Systemd
+
*[[Systemd]]
*Linux ランレベル
+
*[[Linux ランレベル]]
  # chkconfig --list vsftpd
+
  # [[chkconfig]] --list vsftpd
 
  vsftpd          0:off  1:off  2:off  3:on    4:off  5:off  6:off
 
  vsftpd          0:off  1:off  2:off  3:on    4:off  5:off  6:off
 
  # runlevel
 
  # runlevel
 
  N 3
 
  N 3
  # chkconfig --level 3 vsftpd on
+
  # [[chkconfig]] --level 3 vsftpd on
  
 
====CentOs7 OS起動時に起動させる====
 
====CentOs7 OS起動時に起動させる====
 
  # systemctl enable vsftpd
 
  # systemctl enable vsftpd
 
====テキストモードで起動====
 
====テキストモードで起動====
=====CentOS6=====
+
=====[[CentOS]]6=====
 
*常に
 
*常に
 
id:5:initdefault: -> id:3:initdefault:
 
id:5:initdefault: -> id:3:initdefault:
  
  # vi /etc/inittab
+
  # [[vi]] /etc/inittab
 
           :
 
           :
 
  # Default runlevel. The runlevels used are:
 
  # Default runlevel. The runlevels used are:
384行目: 384行目:
 
  # init 3
 
  # init 3
 
====ファイアーウォールの設定====
 
====ファイアーウォールの設定====
=====CentOS7=====
+
=====[[CentOS7]]=====
 
*Firewall
 
*Firewall
  # firewall-cmd --add-service=ftp --permanent
+
  # firewall-cmd --add-ser[[vi]]ce=ftp --permanent
 
  success
 
  success
 
  # firewall-cmd --reload
 
  # firewall-cmd --reload
 
  success
 
  success
  
=====CentOS 6=====
+
=====[[CentOS]] 6=====
 
*/etc/sysconfig/iptables-config に追記
 
*/etc/sysconfig/iptables-config に追記
 
  IPTABLES_MODULES="nf_conntrack_ftp"
 
  IPTABLES_MODULES="nf_conntrack_ftp"
 
*iptables の再起動
 
*iptables の再起動
  # service iptables restart
+
  # ser[[vi]]ce iptables restart
  
 
*iptables の設定と保存
 
*iptables の設定と保存
  # iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
+
  # iptables -A INPUT -m state --state [[R]]ELATED,ESTABLISHED -j ACCEPT
 
  # iptables -I INPUT -p tcp -m tcp --dport ftp -j ACCEPT
 
  # iptables -I INPUT -p tcp -m tcp --dport ftp -j ACCEPT
  # service iptables save
+
  # ser[[vi]]ce iptables save
  # service iptables restart
+
  # ser[[vi]]ce iptables restart
  
====SELinuxによりエラー====
+
====SE[[Linux]]によりエラー====
*以下の様なエラーはSELinuxが出している。SELinuxを無効にするには、setenforce 0 を実行
+
*以下の様なエラーはSE[[Linux]]が出している。SE[[Linux]]を無効にするには、setenforce 0 を実行
*上記、SELinux の無効化 参照
+
*上記、SE[[Linux]] の無効化 参照
 
  C:\Users\piroto>ftp 192.168.24.12
 
  C:\Users\piroto>ftp 192.168.24.12
 
  192.168.24.12 に接続しました。
 
  192.168.24.12 に接続しました。
420行目: 420行目:
 
=====Centos7=====
 
=====Centos7=====
 
  # systemctl enable vsftpd
 
  # systemctl enable vsftpd
  Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
+
  Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.ser[[vi]]ce to /usr/lib/systemd/system/vsftpd.ser[[vi]]ce.
 
===ウェブサーバー===
 
===ウェブサーバー===
 
====設定====
 
====設定====
431行目: 431行目:
  
 
====起動====
 
====起動====
  # service httpd start
+
  # ser[[vi]]ce httpd start
 
  httpd を起動中:                                            [  OK  ]
 
  httpd を起動中:                                            [  OK  ]
 
====確認====
 
====確認====
 
[[File:0306_centos_init07.jpg]]
 
[[File:0306_centos_init07.jpg]]
 
====ランレベル 3 で自動起動するように====
 
====ランレベル 3 で自動起動するように====
*Linux ランレベル
+
*[[Linux ランレベル]]
  # chkconfig --list httpd
+
  # [[chkconfig]] --list httpd
 
  httpd          0:off  1:off  2:off  3:off  4:off  5:off  6:off
 
  httpd          0:off  1:off  2:off  3:off  4:off  5:off  6:off
 
  # runlevel
 
  # runlevel
 
  N 3
 
  N 3
  # chkconfig --level 3 httpd on
+
  # [[chkconfig]] --level 3 httpd on
  
  
457行目: 457行目:
  
 
*再起動
 
*再起動
  /sbin/service httpd restart
+
  /sbin/ser[[vi]]ce httpd restart
 
====SSL====
 
====SSL====
 
*https://weblabo.oscasierra.net/letsencrypt-2/
 
*https://weblabo.oscasierra.net/letsencrypt-2/
465行目: 465行目:
  
 
{{ref SSL.pdf}}
 
{{ref SSL.pdf}}
{{ref SSL_CRON.pdf}}
+
{{ref SSL_C[[R]]ON.pdf}}
===subversion===
+
===[[subversion]]===
 
====インストール====
 
====インストール====
*subversionの導入
+
*[[subversionの導入]]
  # yum install subversion
+
  # yum install [[subversion]]
 
  # yum install mod_dav_svn.so
 
  # yum install mod_dav_svn.so
  
476行目: 476行目:
 
  # cd /var/www/svn
 
  # cd /var/www/svn
 
  # svnadmin create repo
 
  # svnadmin create repo
  # chown -R apache.apache repo
+
  # chown -[[R]] apache.apache repo
  
 
====パスワードの設定====
 
====パスワードの設定====
482行目: 482行目:
  
 
====設定ファイルの変更====
 
====設定ファイルの変更====
=====/etc/httpd/conf.d/subversion.conf=====
+
=====/etc/httpd/conf.d/[[subversion]].conf=====
 
  <Location /svn>
 
  <Location /svn>
 
   DAV svn
 
   DAV svn
488行目: 488行目:
 
    
 
    
 
   # Limit write permission to list of valid users.
 
   # Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
+
   <LimitExcept GET P[[R]]OPFIND OPTIONS [[R]]EPO[[R]]T>
       # Require SSL connection for password protection.
+
       # [[R]]equire SSL connection for password protection.
       # SSLRequireSSL
+
       # SSL[[R]]equireSSL
 
   
 
   
 
       AuthType Basic
 
       AuthType Basic
       AuthName "Authorization Realm"
+
       AuthName "Authorization [[R]]ealm"
 
       AuthUserFile /etc/httpd/.passwd  <- 上で作成したパスワードファイルを指定
 
       AuthUserFile /etc/httpd/.passwd  <- 上で作成したパスワードファイルを指定
       Require valid-user
+
       [[R]]equire valid-user
 
   </LimitExcept>
 
   </LimitExcept>
 
  </Location>
 
  </Location>
501行目: 501行目:
 
  Location /svn で場所を指定する
 
  Location /svn で場所を指定する
 
====再起動====
 
====再起動====
  # /sbin/service httpd restart
+
  # /sbin/ser[[vi]]ce httpd restart
  
 
====引っ越し====
 
====引っ越し====
subversion リポジトリの引越し
+
[[subversion リポジトリの引越し]]
===GCC===
+
===[[GCC]]===
 
====インストール====
 
====インストール====
 
*これがないと、ソースからコンパイルできない
 
*これがないと、ソースからコンパイルできない
 
  # yum install gcc
 
  # yum install gcc
===Python===
+
===[[Python]]===
*CentOS6にPython2.7をインストール
+
*[[CentOS6にPython2.7をインストール]]
===MySQL===
+
===[[MySQL]]===
 
====インストール====
 
====インストール====
 
  # yum install mysql-server
 
  # yum install mysql-server
517行目: 517行目:
 
  # /etc/rc.d/init.d/mysqld start
 
  # /etc/rc.d/init.d/mysqld start
 
=====自動起動=====
 
=====自動起動=====
  # chkconfig --level 3 mysqld on
+
  # [[chkconfig]] --level 3 mysqld on
 
====設定====
 
====設定====
 
=====root パスワードの変更=====
 
=====root パスワードの変更=====
 
  # mysql
 
  # mysql
  Welcome to the MySQL monitor.  Commands end with ; or \g.
+
  Welcome to the [[MySQL]] monitor.  Commands end with ; or \g.
  Your MySQL connection id is 2
+
  Your [[MySQL]] connection id is 2
 
  Server version: 5.0.77 Source distribution
 
  Server version: 5.0.77 Source distribution
 
   
 
   
542行目: 542行目:
 
  Query OK, 0 rows affected (0.00 sec)
 
  Query OK, 0 rows affected (0.00 sec)
 
=====管理権限をユーザーに追加=====
 
=====管理権限をユーザーに追加=====
  mysql> grant all privileges on *.* to piroot@localhost identified by 'newpassword' with grant option;
+
  mysql> grant all pri[[vi]]leges on *.* to piroot@localhost identified by 'newpassword' with grant option;
 
  Query OK, 0 rows affected (0.00 sec)
 
  Query OK, 0 rows affected (0.00 sec)
  mysql> grant all privileges on *.* to piroot@"%" identified by 'newpassword' with grant option;
+
  mysql> grant all pri[[vi]]leges on *.* to piroot@"%" identified by 'newpassword' with grant option;
 
  Query OK, 0 rows affected (0.00 sec)
 
  Query OK, 0 rows affected (0.00 sec)
  
572行目: 572行目:
 
  Query OK, 1 row affected (0.10 sec)
 
  Query OK, 1 row affected (0.10 sec)
  
===Git===
+
===[[Git]]===
 
*http://git-scm.com/
 
*http://git-scm.com/
 
====ダウンロードとインストール====
 
====ダウンロードとインストール====
*Git
+
*[[Git]]
 
  # wget http://kernel.org/pub/software/scm/git/git-1.7.3.2.tar.bz2
 
  # wget http://kernel.org/pub/software/scm/git/git-1.7.3.2.tar.bz2
 
  # tar -xvf git-1.7.3.2.tar.bz2
 
  # tar -xvf git-1.7.3.2.tar.bz2
583行目: 583行目:
  
  
===Oracle Java SDK のインストール===
+
===[[Oracle]] Java SDK のインストール===
 
===Jdk 7===
 
===Jdk 7===
 
*http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/
 
*http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/
594行目: 594行目:
 
  準備中...                ########################################### [100%]
 
  準備中...                ########################################### [100%]
 
     1:jdk                    ########################################### [100%]
 
     1:jdk                    ########################################### [100%]
  Unpacking JAR files...
+
  Unpacking JA[[R]] files...
 
   rt.jar...
 
   rt.jar...
 
  jsse.jar...
 
  jsse.jar...
624行目: 624行目:
 
  # java -version
 
  # java -version
 
  java version "1.7.0_51"
 
  java version "1.7.0_51"
  Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
+
  [[Java]](TM) SE Runtime Environment (build 1.7.0_51-b13)
  Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)  
+
  [[Java]] HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)  
 
=====javac=====
 
=====javac=====
 
  # javac -version
 
  # javac -version
639行目: 639行目:
 
  # chmod +x jdk-6u25-linux-i586.bin  
 
  # chmod +x jdk-6u25-linux-i586.bin  
 
  # ./jdk-6u25-linux-i586.bin  
 
  # ./jdk-6u25-linux-i586.bin  
  # vi /etc/profile.d/java.sh
+
  # [[vi]] /etc/profile.d/java.sh
 
  export JAVA_HOME=/opt/jdk1.6.0_25
 
  export JAVA_HOME=/opt/jdk1.6.0_25
 
  export PATH=$JAVA_HOME/bin:$PATH
 
  export PATH=$JAVA_HOME/bin:$PATH
646行目: 646行目:
 
  # alternatives --config java
 
  # alternatives --config java
 
   
 
   
  There is 1 program that provides 'java'.
+
  There is 1 program that pro[[vi]]des 'java'.
 
   
 
   
 
   Selection    Command
 
   Selection    Command
654行目: 654行目:
 
  Enter to keep the current selection[+], or type selection number:  
 
  Enter to keep the current selection[+], or type selection number:  
 
===Windowの設定===
 
===Windowの設定===
*CentOS メニューの編集
+
*[[CentOS メニューの編集]]
  
 
==パッケージ管理==
 
==パッケージ管理==
===EPEL(Extra Packages for Enterprise Linux)設定===
+
===EPEL(Extra Packages for Enterprise [[Linux]])設定===
 
*http://typea.info/blg/glob/2014/07/docker-docker-ry.html
 
*http://typea.info/blg/glob/2014/07/docker-docker-ry.html
 
=====有効か確認=====
 
=====有効か確認=====
 
*https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F
 
*https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F
=====CentOS 7 用=====
+
=====[[CentOS]] 7 用=====
*http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/repoview/epel-release.html
+
*http://ftp.riken.jp/[[Linux]]/fedora/epel/7/x86_64/repoview/epel-release.html
=====RPM=====
+
=====[[RPM]]=====
*http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
+
*http://ftp.riken.jp/[[Linux]]/fedora/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
 
=====ダウンロードとインストール=====
 
=====ダウンロードとインストール=====
  # wget http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
+
  # wget http://ftp.riken.jp/[[Linux]]/fedora/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
 
  # rpm -Uvh epel-release-7-1.noarch.rpm
 
  # rpm -Uvh epel-release-7-1.noarch.rpm

2020年2月16日 (日) 04:23時点における版

目次

CentOS 初期設定

CentOS | Linux | Fedora | CentOS7 |

  • 初期設定する手順をまとめておく

インストール

バージョンの確認

# cat /etc/*release                                                                             
CentOS release 6.2 (Final)
CentOS release 6.2 (Final)
CentOS release 6.2 (Final)

ネットワークインストール

ネットワークインストール用 bootイメージ
FTPインストール指定先

Xen ゲストOSとしてインストール

日本語環境の設定

日本語サポートのインストール

# yum groupinstall install "Japanese Support"
# vi /etc/sysconfig/i18n
  LANG="ja_JP.UTF-8"

日本語フォントのインストール

テキストモードでインストールすると、日本語フォントがインストールされない

0302 centos init03.jpg

日本語フォントをインストールする
# yum install fonts-japanese 

0303 centos init04.jpg

最初の設定

SSH

  • ~/.ssh/config に接続情報を記述しておくとsshのログインパラメータを都度指定する必要がない
Host phraseit.info
        HostName        phraseit.info
        IdentityFile    ~/.ssh/xxxxxx.pem
        User            ec2-user
Host typea.info
        HostName        typea.info
        User            root
        Port            3843

Cygwinでconfigファイルを利用するには以下の手順が必要

$ chgrp Users config
$ chmod 600 config

Cygwinで公開鍵を使う場合以下の手順が必要

chgrp Users ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa

ネットワーク設定

IPアドレスの設定

VNCを使えるようにする。

  • GUIを使えると便利な局面も多いので、まずVNCを使えるようにしておく
  • Fedoraと同様まず、コマンドから、5901ポートを開けて、VNCサーバーを使えるようにする。

CentOS 7

<blockquote>以下の手順ではサービスがACTIVEにならず</blockquote>

install
# yum install tigervnc-server
設定編集
# cat /etc/sysconfig/vncservers 
# THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.service
  • Copy this file to /etc/systemd/system/vncserver@:<display>.service
# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service            
  • Edit <USER> and vncserver parameters appropriately ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2") [Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l piroto -c "/usr/bin/vncserver -geometry 1024x768 -nolisten tcp -localhost"                                                      
PIDFile=/home/piroto.vnc/%H%i.pid                                                                                 
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

# su piroto                                                                                
[piroto@localhost system]$ vncpasswd
Password:
Verify:
  • Run `systemctl daemon-reload`
# systemctl daemon-reload 
  • Run `systemctl enable vncserver@:<display>.service`
# systemctl enable vncserver@:1.service

ln -s '/etc/systemd/system/vncserver@:1.service' '/etc/systemd/system/multi-user.target.wants/vncserver@:1.service'

Firewall

# firewall-cmd --permanent --zone=public --add-port=5900-5910/tcp
success
# firewall-cmd --reload
success

CentOS 6

install
# yum install tigervnc-server
設定編集(pirotoはユーザー名)
#  vi /etc/sysconfig/vncservers
      :
VNCSERVERS="1:piroto"
VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -localhost"

Chain(RH-Firewall-1-INPUT) および、インデックス(10) は iptables -L で確認し、適宜値を変える

# iptables -I RH-Firewall-1-INPUT 10 -m state --state NEW -p tcp --dport 5901 -j ACCEPT
# iptables -I INPUT 8 -p tcp --dport 5900:5910 -j ACCEPT          

保存と再起動

# service iptables save
# service iptables restart

確認

# iptables -L
    : 
Chain RH-Firewall-1-INPUT (2 references)
    : 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:5901 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

VNCサーバーの起動

Fedora同様の処理

Twn 以外のウィンドウマネージャーを使えるように switchdesk をインストール

# yum install switchdesk

VNCサーバーの設定を置き換え

# switchdesk gnome
Red Hat Linux switchdesk 4.0
Copyright (C) 1999-2004 Red Hat, Inc
Redistributable under the terms of the GNU General Public License
Desktop now set up to run GNOME.
# cd /root/.vnc
# mv xstartup xstartup.bak
# ln -s /root/.Xclients xstartup

解像度の変更

  • /usr/bin/vncserver の geometry に解像度を指定
#
# Global variables.  You may want to configure some of these for your site.
#

$geometry = "1360x600";  

起動

# vncserver

New 'krishna.typea.info:1 (root)' desktop is krishna.typea.info:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/krishna.typea.info:1.log

0307 centos vnc01.jpg

終了

#vncserver -kill :1

自動起動

  • /etc/sysconfig/vncservers を編集
  • 以下をコメントイン
VNCSERVERS="1:piroto"                                                                                             
VNCSERVERARGS[2]="-geometry 1366x768 -nolisten tcp -localhost"
  • サービスの設定
# chkconfig --level 3 vncserver on   

SELinux の設定

SELinux の無効化

確認
  • 有効
[root@susanoo vsftpd]# getenforce
Enforcing
  • 無効
[root@susanoo vsftpd]# getenforce
Permissive
無効化
[root@susanoo vsftpd]# setenforce 0
設定ファイル編集
# vi /etc/selinux/config
  • SELINUX=enforcing → disabled に変更
#chroot_list_file=/etc/vsftpd/chroot_list
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
SELinuxコンテキスト
  • ls-al したときに、末尾にピリオドがついているものは、SELinuxコンテキストが付与されている
drwxr-xr-x.  8 root   root    4096  8月 16 19:46 2013 repo
  • -Zで内容を確認できる
drwxr-xr-x. root   root   unconfined_u:object_r:user_home_t:s0 repo


ファイアーウォールの設定

iptables

Chain

iptablesは、指定したルールに当てはまるパケットに対しての、処理内容を定義します。このルールのグループをチェインと言い、このチェインには、最初から定義されている組み込みチェインと、後から定義するユーザー定義チェインの2種類があります。

policy

各チェイン毎のルールのどれにもマッチしない場合は、そのチェインに定義されている「policy」の内容により、パケットを処理します。

  • Chain INPUT (policy ACCEPT):サーバーに入ってくるパケットのうち、設定したどのルールにもマッチしない場合は、パケットを通過させる。
  • Chain OUTPUT (policy DROP):サーバーから出て行くパケットのうち、設定したどのルールにもマッチしない場合は、パケットを破棄する。
target
  • ルールに該当するパケットの処理方法
  • ACCEPT:パケットを通過させる
  • DROP:パケットを破棄する
prot

プロトコル名

  • all:全てのプロトコル
  • tcp:tcpプロトコル
source

送信元IPアドレス

destinatior

送信先IPアドレス

iptablesコマンドのオプション
チェイン 説明
指定したチェインのポリシーを変更
指定したチェインに新しいルールを追加
指定チェインのルールを削除
新しいユーザー定義チェインを作成
指定したユーザー定義チェインを削除
ルールの初期化(※policyの設定は初期化されません)
,-p (--protocol) ,--sport ,--dport
条件 説明
ターゲット 条件に合った際のアクションを指定
プロトコル名 プロトコル名(tcp, udp, icmp, all)を指定
IPアドレス 送信元アドレス(IPアドレスかホスト名)を指定
IPアドレス 送信先アドレス(IPアドレスかホスト名)を指定
送信元ポート番号 送信元ポート番号(80, httpなど)を指定
宛先ポート番号 宛先ポート番号(80, httpなど)を指定
デバイス パケット入力のインターフェースを指定
デバイス パケットを出力するインターフェースを指定
アクション 説明
ACCEPT パケットの通過を許可
DROP 通過しようとするパケットの破棄
LOG ログの取得
REJECT パケットを拒否し、ICMPメッセージを返信
バックアップ
# cd /etc/sysconfig
# cp iptables iptables.old 
cp: `iptables.old' を上書きしてもよろしいですか(yes/no)? y
80,80ポートを許可する例
-A INPUT -p tcp --dport http -j ACCEPT
-A INPUT -p tcp --dport 8080 -j ACCEPT
起動、停止、再起動
# /etc/rc.d/init.d/iptables start
# /etc/rc.d/init.d/iptables stop
# /etc/rc.d/init.d/iptables restart
確認
# iptables -nL

GUIから、ファイアーウォールを設定する。

0304 centos init05.jpg

WWW や FTP のポートを利用可能に

0305 centos init06.jpg


FTPサーバー

インストールされているか確認

# rpm -q vsftpd
package vsftpd is not installed

インストール

# yum install -y vsftpd
Loaded plugins: fastestmirror
         :
Installed:
 vsftpd.i686 0:2.2.2-11.el6_4.1                                                                                

Complete!

vsftpd の確認

# rpm -q vsftpd
vsftpd-2.0.5-16.el5_4.1

設定の編集

/etc/vsftpd/vsftpd.conf
Anonymous ログインを無効にする
#anonymous_enable=YES
ログを出力させる
xferlog_file=/var/log/vsftpd.log
接続制限
  • 以下を確認
tcp_wrappers=YES
  • /etc/hosts.allow に以下を追記(制限をかけるときはここで)
vsftpd : ALL : ALLOW

ユーザーの追加

rootでは ftp サーバーにログインできない。

<blockquote>非推奨だが、root でログインできる様にするためには、/etc/vsftpd/ftpusers、/etc/vsftpd/user_list の両方からroot 行をコメントアウトすることで可能</blockquote>

  • ユーザーを追加して、パスワードを設定して、root グループに所属させる(任意)
  • Linux ユーザ管理
# useradd xxxx
# passwd xxxx
# gpasswd -a xxx root

CentOs6 ランレベル 3 で自動起動するように

# chkconfig --list vsftpd
vsftpd          0:off   1:off   2:off   3:on    4:off   5:off   6:off
# runlevel
N 3
# chkconfig --level 3 vsftpd on

CentOs7 OS起動時に起動させる

# systemctl enable vsftpd

テキストモードで起動

CentOS6
  • 常に

id:5:initdefault: -> id:3:initdefault:

# vi /etc/inittab
         :
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
  • 今回のみ
# init 3

ファイアーウォールの設定

CentOS7
  • Firewall
# firewall-cmd --add-service=ftp --permanent
success
# firewall-cmd --reload
success
CentOS 6
  • /etc/sysconfig/iptables-config に追記
IPTABLES_MODULES="nf_conntrack_ftp"
  • iptables の再起動
# service iptables restart
  • iptables の設定と保存
# iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -I INPUT -p tcp -m tcp --dport ftp -j ACCEPT
# service iptables save
# service iptables restart

SELinuxによりエラー

  • 以下の様なエラーはSELinuxが出している。SELinuxを無効にするには、setenforce 0 を実行
  • 上記、SELinux の無効化 参照
C:\Users\piroto>ftp 192.168.24.12
192.168.24.12 に接続しました。
220 (vsFTPd 2.2.2) 
ユーザー (192.168.24.12:(none)): root
331 Please specify the password. 
パスワード:
500 OOPS: cannot change directory:/root
500 OOPS: priv_sock_get_cmd
接続がリモート ホストによって閉じられました。


起動設定

Centos7
# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

ウェブサーバー

設定

  • /etc/httpd/conf/httpd.conf を編集
CGIを利用可能に
<Directory "/var/www/html/tips">
    Options +ExecCGI
    AddHandler cgi-script .cgi
</Directory>

起動

# service httpd start
httpd を起動中:                                            [  OK  ]

確認

0306 centos init07.jpg

ランレベル 3 で自動起動するように

# chkconfig --list httpd
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
# runlevel
N 3
# chkconfig --level 3 httpd on


mod_rewrite を利用できるようにする場合

  • コメントを外す
LoadModule rewrite_module modules/mod_rewrite.so
  • AllowOverride を Allに
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
AllowOverride All
  • 再起動
/sbin/service httpd restart

SSL

# yum install epel-release
# yum install certbot python-certbot-apache

テンプレート:Ref SSL.pdf {{ref SSL_CRON.pdf}}

subversion

インストール

# yum install subversion
# yum install mod_dav_svn.so

リポジトリの作成

# mkdir /var/www/svn
# cd /var/www/svn
# svnadmin create repo
# chown -R apache.apache repo

パスワードの設定

# htpasswd /etc/httpd/.passwd svn

設定ファイルの変更

/etc/httpd/conf.d/subversion.conf
<Location /svn>
  DAV svn
  SVNParentPath /var/www/svn
 
  # Limit write permission to list of valid users.
  <LimitExcept GET PROPFIND OPTIONS REPORT>
     # Require SSL connection for password protection.
     # SSLRequireSSL

     AuthType Basic
     AuthName "Authorization Realm"
     AuthUserFile /etc/httpd/.passwd  <- 上で作成したパスワードファイルを指定
     Require valid-user
  </LimitExcept>
</Location>
Location /svn で場所を指定する

再起動

# /sbin/service httpd restart

引っ越し

subversion リポジトリの引越し

GCC

インストール

  • これがないと、ソースからコンパイルできない
# yum install gcc

Python

MySQL

インストール

# yum install mysql-server

起動

# /etc/rc.d/init.d/mysqld start
自動起動
# chkconfig --level 3 mysqld on

設定

root パスワードの変更
# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> set password for 'root'@'localhost' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'krishna.typea.info' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'root'@'127.0.0.1' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
ユーザーの作成
mysql> create user piroot@"%";
Query OK, 0 rows affected (0.00 sec)
mysql> create user piroot@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'piroot'@'localhost' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> set password for 'piroot'@'%' = password('newpassword');
Query OK, 0 rows affected (0.00 sec)
管理権限をユーザーに追加
mysql> grant all privileges on *.* to piroot@localhost identified by 'newpassword' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to piroot@"%" identified by 'newpassword' with grant option;
Query OK, 0 rows affected (0.00 sec)
権限を限定して追加
mysql> grant create,select,insert,update,delete on *.* to piroot@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant create,select,insert,update,delete on *.* to piroot@"%" identified by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant create,select,insert,update,delete on *.* to piroot@"%" identified by 'password';
Query OK, 0 rows affected (0.00 sec)
確認
mysql> select host, user from mysql.user;
+--------------------+--------+
| host               | user   |
+--------------------+--------+
| %                  | piroot | 
| 127.0.0.1          | root   | 
| krishna.typea.info |        | 
| krishna.typea.info | root   | 
| localhost          |        | 
| localhost          | piroot | 
| localhost          | root   | 
+--------------------+--------+
7 rows in set (0.00 sec)
データベースの作成
mysql> create database mt character set utf8;
Query OK, 1 row affected (0.10 sec)

Git

ダウンロードとインストール

# wget http://kernel.org/pub/software/scm/git/git-1.7.3.2.tar.bz2
# tar -xvf git-1.7.3.2.tar.bz2
# cd git-1.7.3.2
# make
# make install


Oracle Java SDK のインストール

Jdk 7

JDK Download

インストール

$ su
# rpm -Uvh jdk-7u51-linux-i586.rpm 
準備中...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
 	rt.jar...
	jsse.jar...
	charsets.jar...
	tools.jar...
	localedata.jar...
	jfxrt.jar...
	plugin.jar...
	javaws.jar...
	deploy.jar...

alternativesの設定

# alternatives --install /usr/bin/java java /usr/java/latest/bin/java 200000
# alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
# alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000

alternativesで確認

# alternatives --config java

3 プログラムがあり 'java' を提供します。
 
  選択       コマンド
-----------------------------------------------
   1           /usr/lib/jvm/jre-1.7.0-openjdk/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
*+ 3           /usr/java/latest/bin/java

起動して確認

java
# java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing) 
javac
# javac -version
javac 1.7.0_51

Jdk 6

ダウンロード

http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html

インストールと設定

jdk-6u25-linux-i586.bin

# mv jdk-6u25-linux-i586.bin /opt/
# cd /opt/
# chmod +x jdk-6u25-linux-i586.bin 
# ./jdk-6u25-linux-i586.bin 
# vi /etc/profile.d/java.sh
export JAVA_HOME=/opt/jdk1.6.0_25
export PATH=$JAVA_HOME/bin:$PATH
# source /etc/profile.d/java.sh 
# alternatives --install /usr/bin/java java /opt/jdk1.6.0_25/bin/java 2
# alternatives --config java

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /opt/jdk1.6.0_25/bin/java

Enter to keep the current selection[+], or type selection number: 

Windowの設定

パッケージ管理

EPEL(Extra Packages for Enterprise Linux)設定

有効か確認
CentOS 7 用
RPM
ダウンロードとインストール
# wget http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/e/epel-release-7-1.noarch.rpm
# rpm -Uvh epel-release-7-1.noarch.rpm