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

MyMemoWiki

「CentOS」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
1行目: 1行目:
 +
|[[Linux]] | [[Fedora]] | [[CentOS7]] |
 
==[[CentOS]]==
 
==[[CentOS]]==
[[Linux]] | [[Fedora]] |  
+
==[[CentOS 初期設定]]==
===[CentOS 初期設定 初期設定]===
+
*初期設定する手順をまとめておく
*[[CentOS 初期設定]]
+
 
 +
==インストール==
 +
===バージョンの確認===
 +
# cat /etc/*release                                                                           
 +
[[CentOS]] release 6.2 (Final)
 +
[[CentOS]] release 6.2 (Final)
 +
[[CentOS]] release 6.2 (Final)
 +
 
 +
===ネットワークインストール===
 +
 
 +
====例====
 +
=====ネットワークインストール用 bootイメージ=====
 +
*以下から探す
 +
**ftp://ftp.riken.jp/[[Linux]]/centos/
 +
*例 6.2
 +
**ftp://ftp.riken.jp/Linux/centos/6.2/isos/i386/[[CentOS]]-6.0-i386-netinstall.iso
 +
=====FTPインストール指定先=====
 +
*以下から探す
 +
**ftp://ftp.riken.jp/[[Linux]]/centos/
 +
*例 6.2
 +
**ftp://ftp.riken.jp/[[Linux]]/centos/6.2/os/i386/
 +
 
 +
===[http://typea.info/blg/glob/cat5/ Xen ゲストOSとしてインストール]===
 +
*[[Fedora Core 6 Xen のインストール]]
 +
*[http://typea.info/blg/glob/cat5/ Xen ゲストOSとしてインストール]
 +
===日本語環境の設定===
 +
====日本語サポートのインストール====
 +
# yum groupinstall install "Japanese Support"
 +
# [[vi]] /etc/sysconfig/i18n
 +
  LANG="ja_JP.UTF-8"
 +
 
 +
====日本語フォントのインストール====
 +
=====[http://typea.info/blg/glob/2007/01/post.html テキストモードでインストールすると、日本語フォントがインストールされない]=====
 +
[[File:0302_centos_init03.jpg]]
 +
=====日本語フォントをインストールする=====
 +
# yum install fonts-japanese
 +
[[File:0303_centos_init04.jpg]]
 +
====その他===
 +
*[https://www.typea.info/blog/index.php/2016/10/08/wsl_bash/ ディレクトリ名色の変更]
 +
 
 +
==最初の設定==
 +
===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
 +
 
 +
===ネットワーク設定===
 +
====[[Linux ネットワーク設定 ifconfig|IPアドレスの設定]]====
 +
===VNCを使えるようにする。===
 +
*GUIを使えると便利な局面も多いので、まずVNCを使えるようにしておく
 +
*[[Fedora Core 6 ファイヤーウォールの設定|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@.ser[[vi]]ce
 +
 
 +
*Copy this file to /etc/systemd/system/vncserver@:<display>.ser[[vi]]ce
 +
# 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]
 +
Type=forking
 +
# Clean any existing files in /tmp/.X11-unix en[[vi]]ronment
 +
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:
 +
 
 +
*[[R]]un `systemctl daemon-reload`
 +
# systemctl daemon-reload
 +
*Run `systemctl enable vncserver@:<display>.ser[[vi]]ce`
 +
# systemctl enable vncserver@:1.ser[[vi]]ce
 +
ln -s '/etc/systemd/system/vncserver@:1.ser[[vi]]ce' '/etc/systemd/system/multi-user.target.wants/vncserver@:1.ser[[vi]]ce'
 +
====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
 +
      :
 +
VNCSE[[R]]VE[[R]]S="1:piroto"
 +
VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -localhost"
 +
 
 +
====Chain([[R]]H-Firewall-1-INPUT) および、インデックス(10) は iptables -L で確認し、適宜値を変える====
 +
# iptables -I [[R]]H-Firewall-1-INPUT 10 -m state --state NEW -p tcp --dport 5901 -j ACCEPT
 +
 
 +
*8は挿入位置、5900:5910 はポート範囲
 +
*http://www.cyberciti.biz/tips/linux-iptables-how-to-specify-a-range-of-ip-addresses-or-ports.html
 +
# iptables -I INPUT 8 -p tcp --dport 5900:5910 -j ACCEPT         
 +
====保存と再起動====
 +
# ser[[vi]]ce iptables save
 +
# ser[[vi]]ce iptables restart
 +
====確認====
 +
# iptables -L
 +
    :
 +
Chain [[R]]H-Firewall-1-INPUT (2 references)
 +
    :
 +
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:5901
 +
[[R]]EJECT    all  --  anywhere            anywhere            reject-with icmp-host-prohibited
 +
===VNCサーバーの起動===
 +
[[Fedora Core 6 VNCの設定|Fedora同様の処理]]
 +
====Twn 以外のウィンドウマネージャーを使えるように switchdesk をインストール====
 +
# yum install switchdesk
 +
====VNCサーバーの設定を置き換え====
 +
# switchdesk gnome
 +
Red Hat [[Linux]] switchdesk 4.0
 +
Copyright (C) 1999-2004 [[R]]ed Hat, Inc
 +
[[R]]edistributable 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
 +
[[File:0307_centos_vnc01.jpg]]
 +
 
 +
====終了====
 +
#vncserver -kill :1
 +
 
 +
====自動起動====
 +
*/etc/sysconfig/vncservers を編集
 +
*以下をコメントイン
 +
VNCSE[[R]]VE[[R]]S="1:piroto"                                                                                           
 +
VNCSERVERARGS[2]="-geometry 1366x768 -nolisten tcp -localhost"
 +
*サービスの設定
 +
# [[chkconfig]] --level 3 vncserver on 
 +
===SE[[Linux]] の設定===
 +
 
 +
====SE[[Linux]] の無効化====
 +
=====確認=====
 +
*有効
 +
[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 SE[[Linux]] on the system.
 +
# SELINUX= can take one of these three values:
 +
#    enforcing - SE[[Linux]] security policy is enforced.
 +
#    permissive - SE[[Linux]] prints warnings instead of enforcing.
 +
#    disabled - No SE[[Linux]] policy is loaded.
 +
SELINUX=disabled
 +
 
 +
=====SE[[Linux]]コンテキスト=====
 +
*ls-al したときに、末尾にピリオドがついているものは、SE[[Linux]]コンテキストが付与されている
 +
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====
 +
*http://dream.jp/vps/support/manual/mnl_security_04.html
 +
=====Chain=====
 +
iptablesは、指定したルールに当てはまるパケットに対しての、処理内容を定義します。このルールのグループをチェインと言い、このチェインには、最初から定義されている組み込みチェインと、後から定義するユーザー定義チェインの2種類があります。
 +
=====policy=====
 +
各チェイン毎のルールのどれにもマッチしない場合は、そのチェインに定義されている「policy」の内容により、パケットを処理します。
 +
*Chain INPUT (policy ACCEPT):サーバーに入ってくるパケットのうち、設定したどのルールにもマッチしない場合は、パケットを通過させる。
 +
*Chain OUTPUT (policy D[[R]]OP):サーバーから出て行くパケットのうち、設定したどのルールにもマッチしない場合は、パケットを破棄する。
 +
=====target=====
 +
*ルールに該当するパケットの処理方法
 +
*ACCEPT:パケットを通過させる
 +
*D[[R]]OP:パケットを破棄する
 +
=====prot=====
 +
プロトコル名
 +
*all:全てのプロトコル
 +
*tcp:tcpプロトコル
 +
=====source=====
 +
送信元IPアドレス
 +
=====destinatior=====
 +
送信先IPアドレス
 +
 
 +
=====iptablesコマンドのオプション=====
 +
{|class="wikitable"
 +
!チェイン
 +
!説明
 +
|-
 +
|-P (policy)
 +
|指定したチェインのポリシーを変更
 +
|-
 +
|-A (--append)
 +
|指定したチェインに新しいルールを追加
 +
|-
 +
|-D (--delete)
 +
|指定チェインのルールを削除
 +
|-
 +
|-N (--new-chain)
 +
|新しいユーザー定義チェインを作成
 +
|-
 +
|-X (--delete-chain)
 +
|指定したユーザー定義チェインを削除
 +
|-
 +
|-F
 +
|ルールの初期化(※policyの設定は初期化されません)
 +
|-
 +
|}
 +
 
 +
{|class="wikitable"
 +
!条件
 +
!説明
 +
|-
 +
|-j (--jump)
 +
|ターゲット 条件に合った際のアクションを指定
 +
|-
 +
,-p (--protocol)
 +
|プロトコル名 プロトコル名(tcp, udp, icmp, all)を指定
 +
|-
 +
|-s (--source)
 +
|IPアドレス 送信元アドレス(IPアドレスかホスト名)を指定
 +
|-
 +
|-d (--destination)
 +
|IPアドレス 送信先アドレス(IPアドレスかホスト名)を指定
 +
|-
 +
,--sport
 +
|送信元ポート番号 送信元ポート番号(80, httpなど)を指定
 +
|-
 +
,--dport
 +
|宛先ポート番号 宛先ポート番号(80, httpなど)を指定
 +
|-
 +
|-i (--in-interface)
 +
|デバイス パケット入力のインターフェースを指定
 +
|-
 +
|-o (--out-interface)
 +
|デバイス パケットを出力するインターフェースを指定
 +
|-
 +
|}
 +
 
 +
{|class="wikitable"
 +
!アクション
 +
!説明
 +
|-
 +
|ACCEPT
 +
|パケットの通過を許可
 +
|-
 +
|D[[R]]OP
 +
|通過しようとするパケットの破棄
 +
|-
 +
|LOG
 +
|ログの取得
 +
|-
 +
|[[R]]EJECT
 +
|パケットを拒否し、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から、ファイアーウォールを設定する。====
 +
[[File:0304_centos_init05.jpg]]
 +
=====WWW や FTP のポートを利用可能に=====
 +
[[File:0305_centos_init06.jpg]]
 +
 
 +
 
 +
===FTPサーバー===
 +
*[[Fedora Core 6 FTP サーバの構築|Fedora同様]]
 +
 
 +
====インストールされているか確認====
 +
# 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 で自動起動するように====
 +
*[[Systemd]]
 +
*[[Linux ランレベル]]
 +
# [[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
 +
====テキストモードで起動====
 +
=====[[CentOS]]6=====
 +
*常に
 +
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
 +
=====[[CentOS]]7=====
 +
*/etc/systemd/system/default.taget ファイルを入れ替える
 +
<pre>
 +
$ cd /etc/systemd/system
 +
$ sudo rm default.taget
 +
$ sudo ln -s /lib/systemd/system/multi-user.target default.target
 +
</pre>
 +
 
 +
====ファイアーウォールの設定====
 +
=====[[CentOS7]]=====
 +
*Firewall
 +
# firewall-cmd --add-ser[[vi]]ce=ftp --permanent
 +
success
 +
# firewall-cmd --reload
 +
success
 +
 
 +
=====[[CentOS]] 6=====
 +
*/etc/sysconfig/iptables-config に追記
 +
IPTABLES_MODULES="nf_conntrack_ftp"
 +
*iptables の再起動
 +
# ser[[vi]]ce iptables restart
 +
 
 +
*iptables の設定と保存
 +
# iptables -A INPUT -m state --state [[R]]ELATED,ESTABLISHED -j ACCEPT
 +
# iptables -I INPUT -p tcp -m tcp --dport ftp -j ACCEPT
 +
# ser[[vi]]ce iptables save
 +
# ser[[vi]]ce iptables restart
 +
 
 +
====SE[[Linux]]によりエラー====
 +
*以下の様なエラーはSE[[Linux]]が出している。SE[[Linux]]を無効にするには、setenforce 0 を実行
 +
*上記、SE[[Linux]] の無効化 参照
 +
C:\Users\piroto&gt;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.ser[[vi]]ce to /usr/lib/systemd/system/vsftpd.ser[[vi]]ce.
 +
===ウェブサーバー===
 +
====設定====
 +
*/etc/httpd/conf/httpd.conf を編集
 +
=====CGIを利用可能に=====
 +
&lt;Directory "/var/www/html/tips"&gt;
 +
    Options +ExecCGI
 +
    AddHandler cgi-script .cgi
 +
&lt;/Directory&gt;
 +
 
 +
====起動====
 +
# ser[[vi]]ce httpd start
 +
httpd を起動中:                                            [  OK  ]
 +
====確認====
 +
[[File:0306_centos_init07.jpg]]
 +
====ランレベル 3 で自動起動するように====
 +
*[[Linux ランレベル]]
 +
# [[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 を利用できるようにする場合====
 +
*http://centoshome.seesaa.net/article/118972004.html
 +
 
 +
*コメントを外す
 +
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/ser[[vi]]ce httpd restart
 +
====SSL====
 +
*https://weblabo.oscasierra.net/letsencrypt-2/
 +
*[[Apache]]
 +
# yum install epel-release
 +
# yum install certbot python-certbot-apache
 +
 
 +
{{ref SSL.pdf}}
 +
{{ref SSL_C[[R]]ON.pdf}}
 +
 
 +
===[[subversion]]===
 +
====インストール====
 +
*[[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=====
 +
&lt;Location /svn&gt;
 +
  DAV svn
 +
  SVNParentPath /var/www/svn
 +
 
 +
  # Limit write permission to list of valid users.
 +
  &lt;LimitExcept GET P[[R]]OPFIND OPTIONS [[R]]EPO[[R]]T&gt;
 +
      # [[R]]equire SSL connection for password protection.
 +
      # SSL[[R]]equireSSL
 +
 +
      AuthType Basic
 +
      AuthName "Authorization [[R]]ealm"
 +
      AuthUserFile /etc/httpd/.passwd  &lt;- 上で作成したパスワードファイルを指定
 +
      [[R]]equire valid-user
 +
  &lt;/LimitExcept&gt;
 +
&lt;/Location&gt;
 +
 
 +
Location /svn で場所を指定する
 +
====再起動====
 +
# /sbin/ser[[vi]]ce httpd restart
 +
 
 +
====引っ越し====
 +
[[subversion リポジトリの引越し]]
 +
===[[GCC]]===
 +
====インストール====
 +
*これがないと、ソースからコンパイルできない
 +
# yum install gcc
 +
===[[Python]]===
 +
*[[CentOS6にPython2.7をインストール]]
 +
===[[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&gt; set password for 'root'@'localhost' = password('newpassword');
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; set password for 'root'@'krishna.typea.info' = password('newpassword');
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; set password for 'root'@'127.0.0.1' = password('newpassword');
 +
Query OK, 0 rows affected (0.00 sec)
 +
=====ユーザーの作成=====
 +
mysql&gt; create user piroot@"%";
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; create user piroot@localhost;
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; set password for 'piroot'@'localhost' = password('newpassword');
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; set password for 'piroot'@'%' = password('newpassword');
 +
Query OK, 0 rows affected (0.00 sec)
 +
=====管理権限をユーザーに追加=====
 +
mysql&gt; grant all pri[[vi]]leges on *.* to piroot@localhost identified by 'newpassword' with grant option;
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; grant all pri[[vi]]leges on *.* to piroot@"%" identified by 'newpassword' with grant option;
 +
Query OK, 0 rows affected (0.00 sec)
 +
 
 +
=====権限を限定して追加=====
 +
mysql&gt; grant create,select,insert,update,delete on *.* to piroot@localhost identified by 'password';
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; grant create,select,insert,update,delete on *.* to piroot@"%" identified by 'password';
 +
Query OK, 0 rows affected (0.00 sec)
 +
mysql&gt; grant create,select,insert,update,delete on *.* to piroot@"%" identified by 'password';
 +
Query OK, 0 rows affected (0.00 sec)
 +
=====確認=====
 +
mysql&gt; 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&gt; create database mt character set utf8;
 +
Query OK, 1 row affected (0.10 sec)
 +
 
 +
===[[Git]]===
 +
*http://git-scm.com/
 +
====ダウンロードとインストール====
 +
*[[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===
 +
*http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/
 +
====JDK Download====
 +
*http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
 +
 
 +
====インストール====
 +
$ su
 +
# rpm -Uvh jdk-7u51-linux-i586.rpm
 +
準備中...                ########################################### [100%]
 +
    1:jdk                    ########################################### [100%]
 +
Unpacking JA[[R]] 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 pro[[vi]]des 'java'.
 +
 +
  Selection    Command
 +
-----------------------------------------------
 +
*+ 1          /opt/jdk1.6.0_25/bin/java
 +
 +
Enter to keep the current selection[+], or type selection number:
 +
===Windowの設定===
 +
*[[CentOS メニューの編集]]
 +
 
 +
==パッケージ管理==
 +
===EPEL(Extra Packages for Enterprise [[Linux]])設定===
 +
*http://typea.info/blg/glob/2014/07/docker-docker-ry.html
 +
=====有効か確認=====
 +
*https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F
 +
=====[[CentOS]] 7 用=====
 +
*http://ftp.riken.jp/[[Linux]]/fedora/epel/7/x86_64/repoview/epel-release.html
 +
=====[[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
 +
# rpm -Uvh epel-release-7-1.noarch.rpm
 +
 
 +
 
 +
 
 +
 
 +
 
  
 
===[[DB2]]===
 
===[[DB2]]===

2021年1月22日 (金) 00:52時点における版

|Linux | Fedora | CentOS7 |

目次

CentOS

CentOS 初期設定

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

インストール

バージョンの確認

# 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
  • /etc/systemd/system/default.taget ファイルを入れ替える
$ cd /etc/systemd/system
$ sudo rm default.taget
$ sudo ln -s /lib/systemd/system/multi-user.target default.target

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

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




DB2

インストール

DB2

Python

Django(WSGI)

ツール

スクリーンキャプチャ

Tips

バージョンの確認

# cat /etc/redhat-release                                                                       
CentOS release 6.3 (Final)

Hyper-V にインストール

Firewall設定GUIのインストール

yum install system-config-firewall

mailコマンド

Tips

Visual Studio Code

Grub2