Marlock Homes Diary

備忘録。忘れないように書きます。

Docker 1.7 インストール(CentOS 7.1)

こんばんは!!

Docker 1.7をCentOS 7.1にインストールします。

https://docs.docker.com/installation/centos/

# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
# uname -r
3.10.0-123.el7.x86_64


1. OSのアップデート

# yum update

2. Dockerインストールスクリプトの実行

# curl -sSL https://get.docker.com/ | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'
警告: /var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-1.7.1-1.el7.centos.x86_64.rpm: ヘッダー V4 RSA/SHA1 Signature、鍵 ID 2c52609d: NOKEY
docker-engine-1.7.1-1.el7.centos.x86_64.rpm の公開鍵がインストールされていません
Importing GPG key 0x2C52609D:
 Userid     : "Docker Release Tool (releasedocker) <docker@docker.com>"
 Fingerprint: 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
 From       : https://yum.dockerproject.org/gpg

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

3. Dockerの起動

# service docker start
Starting docker (via systemctl):                           [  OK  ]
# service docker status
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
   Active: active (running) since 木 2015-07-30 20:15:57 JST; 9s ago
     Docs: https://docs.docker.com
 Main PID: 14352 (docker)
   CGroup: /system.slice/docker.service
           mq14352 /usr/bin/docker -d -H fd://

 7月 30 20:16:04 localhost.localdomain docker[14352]: time="2015-07-30T20:16...
 7月 30 20:16:05 localhost.localdomain docker[14352]: time="2015-07-30T20:16...
 7月 30 20:16:05 localhost.localdomain docker[14352]: time="2015-07-30T20:16...
 7月 30 20:16:05 localhost.localdomain docker[14352]: time="2015-07-30T20:16...
 7月 30 20:16:05 localhost.localdomain docker[14352]: time="2015-07-30T20:16...
 7月 30 20:16:05 localhost.localdomain docker[14352]: time="2015-07-30T20:16...
 7月 30 20:16:06 localhost.localdomain python[14397]: SELinux is preventing ...

                                                       *****  Plugin catchall...
 7月 30 20:16:06 localhost.localdomain python[14397]: SELinux is preventing ...

                                                       *****  Plugin catchall...
 7月 30 20:16:06 localhost.localdomain python[14397]: SELinux is preventing ...

                                                       *****  Plugin catchall...
 7月 30 20:16:07 localhost.localdomain python[14397]: SELinux is preventing ...

                                                       *****  Plugin catchall...
Hint: Some lines were ellipsized, use -l to show in full.

4. Dockerコマンドの確認

# docker -v
Docker version 1.7.1, build 786b29d

捕捉
# : rootで実行
$ : 一般ユーザで実行 

CentOS 6.5からCentOS 7.0へのアップグレード(補足トラブル:対処)

CentOS 7.0がリリースされしばらく経つので、CentOS 6.5をCentOS 7.0にアップグレードし、CentOS7.0 の新機能を学ぶことにしました。

現行のCentOS

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

参考URL
下記の情報を参考にしました。
http://wiki.centos.org/TipsAndTricks/CentOSUpgradeTool
http://abi.io/blogs/in-place-upgrade-centos-6-5-to-7-0-using-preupg.html

前提条件
CentOSで提供されるアップグレードを使用します。
・ 事前にシステムのバックアップを取得しておきます。
必ずしもアップグレードが成功するわけではないようです。
・ 自己責任で実施して下さい。
失敗した場合は、再インストールもしくはバックアップから復旧して下さい

今回は壊れてよい試験環境で実施しています。

手順
アップグレードのために実施した手順を記載します。

1. yumによるパッケージの最新化(必要であれば)

# yum -y update

2. 再起動(必要であれば)

# reboot

3.アップグレードツール用のレポジトリ作成

# vi /etc/yum.repos.d/upgradetool.repo
[下記を追加]
[upg]
name=CentOS-$releasever - Upgrade Tool
baseurl=http://dev.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

4.アップツールのインストール

# yum install redhat-upgrade-tool preupgrade-assistant-contents

5.Preupgrade Assistantツールを実行

# preupg -l
CentOS6_7
# preupg -s CentOS6_7
Preupg tool doesn't do the actual upgrade.
Please ensure you have backed up your system and/or data in the event of a failed upgrade
 that would require a full re-install of the system from installation media.
Do you want to continue? y/n
[yを入力]

Gathering logs used by preupgrade assistant:
All installed packages : 01/11 ...finished (time 00:01s)
All changed files      : 02/11 ...finished (time 06:10s)
Changed config files   : 03/11 ...finished (time 00:00s)
All users              : 04/11 ...finished (time 00:00s)
All groups             : 05/11 ...finished (time 00:00s)
Service statuses       : 06/11 ...finished (time 00:00s)
All installed files    : 07/11 ...finished (time 00:05s)
All local files        : 08/11 ...finished (time 00:28s)
All executable files   : 09/11 ...finished (time 00:04s)
RedHat signed packages : 10/11 ...finished (time 00:00s)
CentOS signed packages : 11/11 ...finished (time 00:00s)
Assessment of the system, running checks / SCE scripts:
001/096 ...done    (Configuration Files to Review)
002/096 ...done    (File Lists for Manual Migration)
003/096 ...done    (Bacula Backup Software)
004/096 ...done    (MySQL configuration)
005/096 ...done    (Migration of the MySQL data stack)
006/096 ...done    (Changes related to moving from MySQL to MariaDB)
007/096 ...done    (PostgreSQL upgrade content)
008/096 ...running (GNOME Desktop Environment underwent several design modificatdone    (GNOME Desktop Environment underwent several design modifications in CentOS 7 release)
009/096 ...running (KDE Desktop Environment underwent several design modificatiodone    (KDE Desktop Environment underwent several design modifications in CentOS 7 release)
010/096 ...done    (several graphic drivers not supported in CentOS 7)
011/096 ...done    (several input drivers not supported in CentOS 7)
012/096 ..done    (several kernel networking drivers not available in CentOS 7))
013/096 ...done    (several kernel storage drivers not available in CentOS 7)
014/096 ...done    (Names, Options and Output Format Changes in arptables)
015/096 ...done    (BIND9 running in a chroot environment check.)
016/096 ...done    (BIND9 configuration compatibility check)
017/096 ...running (Move dhcpd/dhcprelay arguments from /etc/sysconfig/* to *.sedone    (Move dhcpd/dhcprelay arguments from /etc/sysconfig/* to *.service files)
018/096 ...done    (DNSMASQ configuration compatibility check)
019/096 ...done    (Dovecot configuration compatibility check)
020/096 ...done    (Compatibility Between iptables and ip6tables)
021/096 ...done    (Net-SNMP check)
022/096 ...done    (Squid configuration compatibility check)
023/096 ...done    (Reusable Configuration Files)
024/096 ...done    (VCS repositories)
025/096 ...done    (Added and extended options for BIND9 configuration)
026/096 ...done    (Added options in DNSMASQ configuration)
027/096 ...done    (Packages not signed by CentOS)
028/096 ...done    (Obsoleted rpms)
029/096 ...done    (w3m not available in CentOS 7)
030/096 ...running (report incompatibilities between CentOS 6 and 7 in qemu-guesdone    (report incompatibilities between CentOS 6 and 7 in qemu-guest-agent package)
031/096 ...done    (Removed options in coreutils binaries)
032/096 ...done    (Removed options in gawk binaries)
033/096 ...done    (Removed options in netstat binary)
034/096 ...done    (Removed options in quota tools)
035/096 ...done    (Removed rpms)
036/096 ...done    (Replaced rpms)
037/096 ...done    (GMP library incompatibilities)
038/096 ...done    (package downgrades)
039/096 ...done    (restore custom selinux configuration)
040/096 ...done    (General)
041/096 ...done    (samba shared directories selinux)
042/096 ...done    (CUPS Browsing/BrowsePoll configuration)
043/096 ...done    (CVS Package Split)
044/096 ...done    (FreeRADIUS Upgrade Verification)
045/096 ...done    (httpd configuration compatibility check)
046/096 ...done    (bind-dyndb-ldap)
047/096 ...done    (Identity Management Server compatibility check)
048/096 ...done    (IPA Server CA Verification)
049/096 ...done    (NTP configuration)
050/096 ...done    (Information on time-sync.target)
051/096 ...done    (OpenLDAP /etc/sysconfig and data compatibility)
052/096 ...done    (OpenSSH sshd_config migration content)
053/096 ...done    (OpenSSH sysconfig migration content)
054/096 ...done    (Configuration for quota_nld service)
055/096 ...running (Disk quota netlink message daemon moved into quota-nld packadone    (Disk quota netlink message daemon moved into quota-nld package)
056/096 ...done    (SSSD compatibility check)
057/096 ...done    (Luks encrypted partition)
058/096 ...done    (Clvmd and cmirrord daemon management.)
059/096 ...done    (State of LVM2 services.)
060/096 ...done    (device-mapper-multipath configuration compatibility check)
061/096 ...done    (Removal of scsi-target-utils)
062/096 ...done    (Configuration for warnquota tool)
055/096 ...running (Disk quota netlink message daemon moved into quota-nld packadone    (Disk quota netlink message daemon moved into quota-nld package)
056/096 ...done    (SSSD compatibility check)
057/096 ...done    (Luks encrypted partition)
058/096 ...done    (Clvmd and cmirrord daemon management.)
059/096 ...done    (State of LVM2 services.)
060/096 ...done    (device-mapper-multipath configuration compatibility check)
061/096 ...done    (Removal of scsi-target-utils)
062/096 ...done    (Configuration for warnquota tool)
063/096 ...running (Disk quota tool warnquota moved into quota-warnquota packagedone    (Disk quota tool warnquota moved into quota-warnquota package)
064/096 ...done    (Architecture Support)
065/096 ...done    (Binary rebuilds)
066/096 ...done    (Debuginfo packages)
067/096 ...done    (Cluster and High Availability)
068/096 ...done    (Quorum implementation)
069/096 ...done    (fix krb5kdc config file)
070/096 ...done    (File Systems, Partitions and Mounts Configuration Review)
071/096 ...done    (Read Only FHS directories)
072/096 ...done    (Sonamebumped libs)
073/096 ...done    (SonameKept Reusable Dynamic Libraries)
074/096 ...done    (Removed .so libs)
075/096 ...done    (In-place Upgrade Requirements for the /usr/ Directory)
076/096 ...done    (CA certificate bundles modified)
077/096 ...done    (Developer Tool Set packages)
078/096 ...done    (Hyper-V)
079/096 ...running (Content for enabling and disabling services based on CentOS done    (Content for enabling and disabling services based on CentOS 6 system)
080/096 ...done    (Check for ethernet interface naming)
081/096 ...done    (User modification in /etc/rc.local and /etc/rc.d/rc.local)
082/096 ...done    (cgroups configuration compatibility check)
083/096 ...done    (Plugable authentication modules (PAM))
084/096 ...done    (Foreign Perl modules)
085/096 ...done    (Python 2.7.5)
086/096 ...done    (Ruby 2.0.0)
087/096 ...done    (SCL collections)
088/096 ...done    (System kickstart)
089/096 ...done    (YUM)
090/096 ...done    (Check for usage of dangerous range of UID/GIDs)
091/096 ...done    (Incorrect usage of reserved UID/GIDs)
092/096 ...done    (NIS ypbind config files back-up)
093/096 ...done    (NIS Makefile back-up)
094/096 ...done    (NIS server maps check)
095/096 ...done    (NIS server MAXUID and MAXGID limits check)
096/096 ...done    (NIS server config file back-up)
Assessment finished (time 09:27s)
Result table with checks and their results for main contents:
---------------------------------------------------------------------------------------------------------------
|Bacula Backup Software                                                                    |notapplicable     |
|MySQL configuration                                                                       |notapplicable     |
|Migration of the MySQL data stack                                                         |notapplicable     |
|Changes related to moving from MySQL to MariaDB                                           |notapplicable     |
|PostgreSQL upgrade content                                                                |notapplicable     |
|GNOME Desktop Environment underwent several design modifications in CentOS 7 release      |notapplicable     |
|KDE Desktop Environment underwent several design modifications in CentOS 7 release        |notapplicable     |
|several graphic drivers not supported in CentOS 7                                         |notapplicable     |
|several input drivers not supported in CentOS 7                                           |notapplicable     |
|Names, Options and Output Format Changes in arptables                                     |notapplicable     |
|BIND9 running in a chroot environment check.                                              |notapplicable     |
|BIND9 configuration compatibility check                                                   |notapplicable     |
|Move dhcpd/dhcprelay arguments from /etc/sysconfig/* to *.service files                   |notapplicable     |
|DNSMASQ configuration compatibility check                                                 |notapplicable     |
|Dovecot configuration compatibility check                                                 |notapplicable     |
|Net-SNMP check                                                                            |notapplicable     |
|Squid configuration compatibility check                                                   |notapplicable     |
|Added and extended options for BIND9 configuration                                        |notapplicable     |
|Added options in DNSMASQ configuration                                                    |notapplicable     |
|w3m not available in CentOS 7                                                             |notapplicable     |
|report incompatibilities between CentOS 6 and 7 in qemu-guest-agent package               |notapplicable     |
|restore custom selinux configuration                                                      |notapplicable     |
|samba shared directories selinux                                                          |notapplicable     |
|CUPS Browsing/BrowsePoll configuration                                                    |notapplicable     |
|FreeRADIUS Upgrade Verification                                                           |notapplicable     |
|bind-dyndb-ldap                                                                           |notapplicable     |
|Identity Management Server compatibility check                                            |notapplicable     |
|IPA Server CA Verification                                                                |notapplicable     |
|OpenLDAP /etc/sysconfig and data compatibility                                            |notapplicable     |
|SSSD compatibility check                                                                  |notapplicable     |
|Clvmd and cmirrord daemon management.                                                     |notapplicable     |
|device-mapper-multipath configuration compatibility check                                 |notapplicable     |
|Removal of scsi-target-utils                                                              |notapplicable     |
|Quorum implementation                                                                     |notapplicable     |
|fix krb5kdc config file                                                                   |notapplicable     |
|cgroups configuration compatibility check                                                 |notapplicable     |
|Ruby 2.0.0                                                                                |notapplicable     |
|System kickstart                                                                          |notapplicable     |
|NIS ypbind config files back-up                                                           |notapplicable     |
|NIS Makefile back-up                                                                      |notapplicable     |
|NIS server maps check                                                                     |notapplicable     |
|NIS server MAXUID and MAXGID limits check                                                 |notapplicable     |
|NIS server config file back-up                                                            |notapplicable     |
|several kernel networking drivers not available in CentOS 7                               |pass              |
|several kernel storage drivers not available in CentOS 7                                  |pass              |
|OpenSSH sshd_config migration content                                                     |pass              |
|Configuration for quota_nld service                                                       |pass              |
|Disk quota netlink message daemon moved into quota-nld package                            |pass              |
|Luks encrypted partition                                                                  |pass              |
|Configuration for warnquota tool                                                          |pass              |
|Architecture Support                                                                      |pass              |
|Debuginfo packages                                                                        |pass              |
|Cluster and High Availability                                                             |pass              |
|Read Only FHS directories                                                                 |pass              |
|In-place Upgrade Requirements for the /usr/ Directory                                     |pass              |
|CA certificate bundles modified                                                           |pass              |
|Developer Tool Set packages                                                               |pass              |
|Hyper-V                                                                                   |pass              |
|Check for ethernet interface naming                                                       |pass              |
|Plugable authentication modules (PAM)                                                     |pass              |
|SCL collections                                                                           |pass              |
|Compatibility Between iptables and ip6tables                                              |informational     |
|VCS repositories                                                                          |informational     |
|Removed options in coreutils binaries                                                     |informational     |
|Removed options in gawk binaries                                                          |informational     |
|Removed options in netstat binary                                                         |informational     |
|Removed options in quota tools                                                            |informational     |
|GMP library incompatibilities                                                             |informational     |
|CVS Package Split                                                                         |informational     |
|httpd configuration compatibility check                                                   |informational     |
|NTP configuration                                                                         |informational     |
|Information on time-sync.target                                                           |informational     |
|Disk quota tool warnquota moved into quota-warnquota package                              |informational     |
|File Systems, Partitions and Mounts Configuration Review                                  |informational     |
|Sonamebumped libs                                                                         |informational     |
|SonameKept Reusable Dynamic Libraries                                                     |informational     |
|Removed .so libs                                                                          |informational     |
|Foreign Perl modules                                                                      |informational     |
|YUM                                                                                       |informational     |
|Reusable Configuration Files                                                              |fixed             |
|Replaced rpms                                                                             |fixed             |
|package downgrades                                                                        |fixed             |
|OpenSSH sysconfig migration content                                                       |fixed             |
|State of LVM2 services.                                                                   |fixed             |
|Configuration Files to Review                                                             |needs_inspection  |
|File Lists for Manual Migration                                                           |needs_inspection  |
|Obsoleted rpms                                                                            |needs_inspection  |
|Binary rebuilds                                                                           |needs_inspection  |
|Python 2.7.5                                                                              |needs_inspection  |
|Check for usage of dangerous range of UID/GIDs                                            |needs_inspection  |
|Incorrect usage of reserved UID/GIDs                                                      |needs_inspection  |
|Packages not signed by CentOS                                                             |needs_action      |
|Removed rpms                                                                              |needs_action      |
|General                                                                                   |needs_action      |
|Content for enabling and disabling services based on CentOS 6 system                      |needs_action      |
|User modification in /etc/rc.local and /etc/rc.d/rc.local                                 |needs_action      |
---------------------------------------------------------------------------------------------------------------
Tarball with results is stored here /root/preupgrade-results/preupg_results-150110180525.tar.gz .
The latest assessment is stored in directory /root/preupgrade .
Summary information:
We found some potential in-place upgrade risks.
Read the file /root/preupgrade/result.html for more details.
Upload results to UI by command:
e.g. preupg -u http://127.0.0.1:8099/submit/ -r /root/preupgrade-results/preupg_results-*.tar.gz .

6.レポートの詳細確認
/root/preupgrade/result.htmlに結果が記載されています。
※ 今回は壊れてもよい試験的な環境で実施したため詳細は確認せず、次の手順に進みました。
本来はすべての内容を確認し、対処方法を検討すべき

7.アップグレードの実施

# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
# centos-upgrade-tool-cli --network 7 --instrepo=http://mirror.centos.org/centos/7/os/x86_64/
# centos-upgrade-tool-cli --network 7 --instrepo=http://mirror.centos.org/centos/7/os/x86_64/
setting up repos...
cmdline-instrepo                                         | 3.6 kB     00:00
cmdline-instrepo/primary_db                              | 4.9 MB     00:03
epel/metalink                                            | 4.9 kB     00:00
epel                                                     | 4.4 kB     00:00
epel/primary_db                                          | 6.4 MB     00:00
upg                                                      | 1.9 kB     00:00
upg/primary_db                                           |  14 kB     00:00
No upgrade available for the following repos: base extras updates
.treeinfo                                                | 1.1 kB     00:00
Preupgrade assistant risk check found risks for this upgrade.
You can run preupg --riskcheck --verbose to view these risks.
Addressing high risk issues is required before the in-place upgrade
and ignoring these risks may result in a broken upgrade and unsupported upgrade.
Please backup your data.

List of issues:
INPLACERISK: HIGH: We detected some non-CentOS signed packages, you can find the list in /root/preupgrade/./kickstart/noncentospkgs. You need to handle them yourself!
INPLACERISK: HIGH: After upgrading to CentOS 7 there are still some el6 packages left. Add --cleanup-post option to redhat-upgrade-tool if you want to remove them automatically.
INPLACERISK: HIGH: There were changes in SELinux policies between CentOS 6 and CentOS 7. Please, check solution in order to resolve this issue.
INPLACERISK: HIGH: The service blk-availability on CentOS 7 is disabled by default. Enable them via commands: systemctl enable blk-availability && systemctl start blk-availability.service .
INPLACERISK: HIGH: The service ip6tables on CentOS 7 is disabled by default. Enable them via commands: systemctl enable ip6tables && systemctl start ip6tables.service .
INPLACERISK: HIGH: The service network on CentOS 7 is disabled by default. Enable them via commands: systemctl enable network && systemctl start network.service .
INPLACERISK: HIGH: The service ntpd on CentOS 7 is disabled by default. Enable them via commands: systemctl enable ntpd && systemctl start ntpd.service .
INPLACERISK: HIGH: The service ntpdate on CentOS 7 is disabled by default. Enable them via commands: systemctl enable ntpdate && systemctl start ntpdate.service .
INPLACERISK: HIGH: File /etc/rc.d/rc.local was changed
INPLACERISK: MEDIUM: We detected some packages installed on the system were removed (obsoleted) between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them.
INPLACERISK: MEDIUM: We detected some packages installed on the system were removed between CentOS 6 and CentOS 7. This may break the functionality of the packages depending on them.
[省略]
Continue with the upgrade [Y/N]?
[Yを入力]
[省略]
rpm transaction 100% [=========================================================]
rpm install 100% [=============================================================]
setting up system for upgrade

8. 再起動

# reboot

再起動に時間がかかります。

9. バージョンの確認

# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)

以上で、アップグレードは終了です。

補足:
CentOS 7.0後にupgrade後、下記の問題が発生しました。
a. sshdが起動しないが起動しない

# systemctl start sshd
# systemctl status sshd
sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: activating (auto-restart) (Result: exit-code) since 土 2015-01-10 19:47:47 JST; 5s ago
  Process: 1283 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=127)
  Process: 1281 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
 Main PID: 1283 (code=exited, status=127)

 1月 10 19:47:47 www9379ue.sakura.ne.jp sshd[1283]: /usr/sbin/sshd: error wh...
 1月 10 19:47:47 www9379ue.sakura.ne.jp systemd[1]: sshd.service: main proce...
 1月 10 19:47:47 www9379ue.sakura.ne.jp systemd[1]: Unit sshd.service entere...
Hint: Some lines were ellipsized, use -l to show in full.

b. yumが実行できない

# yum install postgresql
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   libsasl2.so.2: cannot open shared object file: No such file or directory

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

原因特定
libsasl2.so.2 => not foundが原因

# /usr/sbin/sshd
/usr/sbin/sshd: error while loading shared libraries: libsasl2.so.2: cannot open shared object file: No such file or directory
# ldd /usr/sbin/sshd
 [省略]
        libsasl2.so.2 => not found
[省略]

対処

# ln -s /lib64/libsasl2.so.3 /lib64/libsasl2.so.2

今後は、CentOS 7.0の新機能を学んでいこうと思います。

Redmine + PostgreSQL インストール (作成中 2014/11/29)

こんばんは!!
Redmineを使う機会があったので、
下記のURLを参考にインストールを実施してみます。
# DBの設定以外は下記URLの内容をそのまま実施

インストール — Redmine.JP

環境 バージョン
CentOS 6.5

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

1. selinuxの無効化

# vi /etc/sysconfig/selinux
(修正)
#   enforcing - SELinux security policy is enforced.
#   permissive - SELinux prints warnings instead of enforcing.
#   disabled - SELinux is fully disabled.
SELINUX=disabled
(再起動)
# reboot
# getenforce
Disabled

2. ファイアウォールの設定追加(80ポートの解放)

# vi /etc/sysconfig/iptables
(追加)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
(iptables再起動)
# service iptables restart
iptables: チェインをポリシー ACCEPT へ設定中filter         [  OK  ]
iptables: ファイアウォールルールを消去中:                  [  OK  ]
iptables: モジュールを取り外し中:                          [  OK  ]
iptables: ファイアウォールルールを適用中:                  [  OK  ]

3. EPELリポジトリの登録

# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm を取得中
準備中...                ########################################### [100%]
(省略)
# yum repolist
epel                    Extra Packages for Enterprise Linux 6 - x86_64    11,226

4.開発ツール(Cコンパイラ等)のインストール

# yum groupinstall "Development Tools"

5.RubyとPassengerのビルドに必要なヘッダファイルなどのインストール

# yum -y install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel

6.PostgreSQLのインストール

PostgreSQL 9.4 インストール - Marlock Homes Diary

7.Apacheとヘッダファイルのインストール

# yum -y install httpd httpd-devel

8.ImageMagickとヘッダファイル・日本語フォントのインストール

# yum -y install ImageMagick ImageMagick-devel ipa-pgothic-fonts

9.Rubyのインストール
9.1.ダウンロード

# cd /usr/local/src/
# wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p598.tar.gz

9.2.ビルド

# tar xvzf ruby-2.0.0-p598.tar.gz
# cd ruby-2.0.0-p598
# ./configure --disable-install-doc 
# make
# make install
# cd ..

9.3.インストール確認

# ruby -v
ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux]

10.Redmine用データベース作成

# su - postgres
$ createdb redmine_db

11.Redmineのインストール

# cd /usr/local/src/
# curl -O http://www.redmine.org/releases/redmine-2.5.0.tar.gz
# tar xvf redmine-2.5.0.tar.gz
# mv redmine-2.5.0 /var/lib/redmine

12.データベースへの接続設定
# vi /var/lib/redmine/config/database.yml

production:
  adapter: postgresql
  database: redmine_db
  host: localhost
  username: postgres
  password: "postgres"


13.設定ファイル config/configuration.yml の作成

# vi /var/lib/redmine/config/configuration.yml
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: '[fqdnを設定]'

  rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf

14.bundlerのインストール

# gem install bundler --no-rdoc --no-ri

15.Gemパッケージのインストール

# bundle install --without development test

16.Redmineの初期設定とデータベースのテーブル作成

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate

17.Passengerのインストール

# bundle install --without development test

18.PassengerのApache用モジュールのインストール

# passenger-install-apache2-module
#  passenger-install-apache2-module --snippet
LoadModule passenger_module /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53
  PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>

18.1. Apacheの設定

# vi /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.53
  PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>

19. Apache起動

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

20. サブディレクトリでRedmineを実行
20.1. シンボリックリンクの作成

# ln -s /var/lib/redmine/public /var/www/html/redmine

20.2. Apacheへの設定追加

(追加)
RackBaseURI /redmine

20.3. Apache再起動
# service httpd configtest
Syntax OK
# service httpd graceful


以上でredmaineのインストールは完了。
以下にアクセス。

http://[ipアドレス]/redmine

PostgreSQL 9.4.1 インストール

PostgreSQLインストールメモ(バージョン 9.4.1)

最新バージョンの9.4.1をインストールする。

環境 バージョン
CentOS 7.0

# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)


1.環境準備
1.1.make

# gmake -version
GNU Make 3.82


1.2.gcc

# gcc -v
gcc バージョン 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)


1.3. Readline

# yum install readline
パッケージ readline-6.2-9.el7.x86_64 はインストール済みか最新バージョンです
何もしません
# yum install readline-devel
パッケージ readline-devel-6.2-9.el7.x86_64 はインストール済みか最新バージョンで す
何もしません

1.4. zlib

# yum install zlib
パッケージ zlib-1.2.7-13.el7.x86_64 はインストール済みか最新バージョンです
何もしません
# yum install zlib-devel
パッケージ zlib-devel-1.2.7-13.el7.x86_64 はインストール済みか最新バージョンです
何もしません

2.PostgreSQLインストール

2.1.postgresユーザ作成

# useradd postgres

2.2.ソースの入手と解凍

# cd /usr/local/src/
# wget https://ftp.postgresql.org/pub/source/v9.4.1/postgresql-9.4.1.tar.gz
# tar xvzf postgresql-9.4.1.tar.gz
# chown -R postgres:postgres postgresql-9.4.1

2.3.コンパイル

# su - postgres
$ $ cd /usr/local/src/postgresql-9.4.1/
$ ./configure
$ gmake world ※
(省略)
PostgreSQL, contrib, and documentation successfully made. Ready to install.

※ドキュメント(HTMLやman)や追加モジュール(contrib)を含め、構築可能なもの全てを構築したい場合、上記の様にworldを付与して実行

2.4.リグレーションテスト

$ gmake check
(省略)
=======================
 All 145 tests passed.
=======================
(省略)

2.5.インストール

$ su
# gmake install-world
(省略)
PostgreSQL, contrib, and documentation installation complete.


2.6.インストールディレクトリの所有者変更

# cd /usr/local/
# chown -R postgres:postgres pgsql/

2.7.postgresユーザの環境変数設定

# su - postgres
$ vi .bash_profile 
(下記を設定)

# PostgreSQL PATH
export POSTGRES_HOME=/usr/local/pgsql
export PGDATA=/home/postgres/data
export PATH=$PATH:$POSTGRES_HOME/bin
export PGLIB=/usr/local/pgsql/lib
export MANPATH="$MANPATH":$POSTGRES_HOME/man

2.7.postgresユーザの環境変数設定読み込み

$ source .bash_profile

2.8.データベースクラスタの作成

$ initdb -E UTF8 --no-locale


2.9.ログディレクトリの作成

$ mkdir -p /home/postgres/data/pg_log

2.10.ログ出力設定
# ログのみ出力(その他の設定は省略)

$ vi /home/postgres/data/postgresql.conf
#logging_collector = off                # Enable capturing of stderr and csvlog
logging_collector = on

2.10.PostgreSQL起動

$ pg_ctl start
server starting
-bash-4.2$ LOG:  redirecting log output to logging collector process
HINT:  Future log output will appear in directory "pg_log".

これでPostgreSQL9.4の新機能を試すことができる。

以上

WordPressでPostgreSQLを使用する!!

こんにちは!!

ブログの管理に、WordPressを使ってみたいなと!!と思っていましたが、
デフォルトのデータベースがMySQLでした。。。
MySQLより、PostgreSQLの方が慣れているので、
PostgreSQL for WordPress (PG4WP)を使用して、
データベースをPostgreSQLに変更してみました!!

# 以下の手順はPostgreSQLをインストールしていることを前提にしています。

前提条件

1.OSのバージョン

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


2.WordPressのダウンロード

# cd /var/www/html/
# wget http://ja.wordpress.org/wordpress-3.9.1-ja.zip

3.WordPressの展開

# unzip wordpress-3.9.1-ja.zip

4.WordPress設定ファイルの修正

# cd wordpress
# cp -p wp-config-sample.php wp-config.php
# vi wp-config.php
(変更後)
// **PostgreSQLの設定
define('DB_NAME', 'wordpress');
define('DB_USER', 'postgres');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

//https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org の秘密鍵サービスで自動生成した値を記載
define('AUTH_KEY',         'xxxxx');
(以降、省略)

5.PostgreSQL for WordPress (PG4WP)の配置

# cd /var/www/html/wordpress/wp-content/plugins/
# wget http://downloads.wordpress.org/plugin/postgresql-for-wordpress.1.3.0.zip
# unzip postgresql-for-wordpress.1.3.0.zip
# mv postgresql-for-wordpress/pg4wp ./
# rm postgresql-for-wordpress.1.3.0.zip

6.PostgreSQL for WordPress (PG4WP)の設定

# cd pg4wp/
# vi db.php
(編集後)
define( 'PG4WP_INSECURE', true);
wb-content直下に移動させる
# mv db.php ../../

7.WordPress用のデータベース作成

# su - postgres
$ createdb wordpress

8.WordPressインストール
ブラウザから/wordpress/wp-admin/install.phpにアクセスしてインストール。

補足
a.Word-Pressインストール時のエラー対処

1.以下のメッセージがブラウザに出力された

Your PHP installation appears to be missing the PostgreSQL extension which is required by WordPress with PG4WP.

以下を実行

# yum install php-pgsql

2.ブラウザに何も表示されない。
apacheerror_logを確認

tail -f /var/log/httpd/error_log
PHP Fatal error:  Call to undefined function wpsql_errno() in /var/www/html/wordpress/wp-content/plugins/pg4wp/core.php(32) : eval()'d code on line 1531

以下を修正

# vi /var/www/html/wordpress/wp-content/plugins/pg4wp/driver_pgsql.php
(以下を追加)
        function wpsql_errno( $connection) {
                $result = pg_get_result($connection);
                $result_status = pg_result_status($result);
        return pg_result_error_field($result_status, PGSQL_DIAG_SQLSTATE);
        }
||<        

参考URL
https://vitoriodelage.wordpress.com/2014/06/06/add-missing-wpsql_errno-in-pg4wp-plugin/

b.インストール完了時のメッセージ

(原因調査中)
>||
WordPress database error: [ERROR: syntax error at or near "," LINE 1: DELETE a, b FROM wp_options a, wp_options b WHERE ^]
DELETE a, b FROM wp_options a, wp_options b WHERE a.option_name LIKE '\_transient\_%' AND a.option_name NOT LIKE '\_transient\_timeout\_%' AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) AND b.option_value < 1403947144

WordPress database error: [ERROR: syntax error at or near "," LINE 1: DELETE a, b FROM wp_options a, wp_options b WHERE ^]
DELETE a, b FROM wp_options a, wp_options b WHERE a.option_name LIKE '\_site\_transient\_%' AND a.option_name NOT LIKE '\_site\_transient\_timeout\_%' AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) AND b.option_value < 1403947144

成功しました !

WordPress がインストールされました。もっと何か作業をしたかったですか ? がっかりさせてゴメンナサイ。これだけです 

MySQL 5.6.17インストール手順

MySQLをインストールしたことがなかったので、
試しにインストールしてみる事にしました。

ソースコードコンパイルし、インストールすることにします。

MySQL 5.6.17インストール手順の備忘録

OS:CentOS release 6.5 (Final)

0.前提条件

# yum list installed cmake
Installed Packages
cmake.x86_64                          2.6.4-5.el6                          @base

1.ソースコードの取得

a.下記のURLアクセス
http://dev.mysql.com/downloads/mysql/
b.Select Platform:「Source Code」を設定
c.「Generic Linux (Architecture Independent), Compressed TAR Archive」横の
  「DownLoad」を押下
※ただし、ダウンロードにはユーザ登録が必要


2.取得したソースコードをアップロード
インストールを行うサーバに以下の資材を格納する。

・ソースコード:mysql-5.6.17.tar.gz
・ディレクトリ:/usr/local/src
# ls -l /usr/local/src/mysql-5.6.17.tar.gz
-rw-r--r-- 1 root root 32862539  5月 23 00:36 2014 /usr/local/src/mysql-5.6.17.tar.gz

3.ソースコードの解凍とインストール

# cd /usr/local/src/
# tar zxvf mysql-5.6.17.tar.gz
# cd mysql-5.6.17
# cmake -DMYSQL_DATADIR=/var/lib/mysql
※データディレクトリのみ指定する。
(cmake実行結果①)
-- Could NOT find Curses  (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:85 (MESSAGE):
  Curses library not found.  Please install appropriate package,

上記メッセージが出力されたため、以下を実施。

# yum install ncurses-devel
# yum list installed ncurses-devel
Installed Packages
ncurses-devel.x86_64                  5.7-3.20090208.el6                   @base
# rm CMakeCache.txt
rm: remove 通常ファイル `CMakeCache.txt'? Y
(cmake実行結果②)
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/src/mysql-5.6.17
[100%] Built target mysqltest_embedded
Scanning dependencies of target my_safe_process
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
Linking CXX executable my_safe_process
# make install
-- Installing: /usr/local/mysql/man/man1/mysql_zap.1
-- Installing: /usr/local/mysql/man/man1/myisam_ftdump.1
-- Installing: /usr/local/mysql/man/man8/mysqld.8
-- Installing: /usr/local/mysql/support-files/solaris/postinstall-solaris

4.ユーザ作成

# groupadd mysql
# useradd -g mysql mysql

5.データベースの初期化

# cd /usr/local/mysql
# scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

6.ディレクトリの権限変更

# chown -R mysql:mysql /usr/local/mysql

7.起動スクリプトの配置

# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

8.設定ファイルの修正

# cp /usr/local/mysql/support-files/my-default.cnf
/etc/my.cnf
cp: `/etc/my.cnf' を上書きしてもよろしいですか(yes/no)? yes
# vi /etc/my.cnf
(以下を追加)
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
socket = /usr/local/mysql/mysql.sock

9.MySQLの起動

# /etc/init.d/mysqld start
Starting MySQL SUCCESS!

10.MySQLへの接続

# /usr/local/mysql/bin/mysql -h 127.0.0.1 -u mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.17 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>