|
|
1行目: |
1行目: |
| ==準備== | | ==準備== |
| *インストール済みのパッケージを削除 | | *SQLiteのCソースコード |
| | <ol> |
| | <li>'''ソースの取得''' |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| [root@XXXXX ~]# yum remove httpd | | [root@XXXXX ~]# wget -P /usr/local/src https://www.sqlite.org/2019/sqlite-amalgamation-3280000.zip |
| </syntaxhighlight > | | </syntaxhighlight> |
| | | </li> |
| *[[APR 1.7.0(RPM)]] のインストール
| | <li>'''ソースの解凍''' |
| | | <syntaxhighlight lang="bash"> |
| *[[APR-util 1.6.1(RPM)]] のインストール
| | [root@XXXXX ~]# cd /usr/local/src |
| | | [root@XXXXX ~]# unzip sqlite-amalgamation-3280000.zip |
| | </syntaxhighlight> |
| | 解凍されたディレクトリは後から使用するので解凍だけしておく。 |
| | </li> |
| | </ol> |
| ==インストール== | | ==インストール== |
| <ol> | | <ol> |
| <li>'''ソースの取得''' | | <li>'''ソースの取得''' |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| [root@XXXXX ~]# su - rpmdevel | | [root@XXXXX ~]# wget -P /usr/local/src http://ftp.riken.jp/net/apache/subversion/subversion-1.12.0.tar.gz |
| [rpmdevel@XXXXX ~]$ cd /home/rpmdevel/src
| | </syntaxhighlight> |
| [rpmdevel@XXXXX ~]$ wget http://ftp.riken.jp/net/apache/httpd/httpd-2.4.39.tar.bz2
| |
| </syntaxhighlight > | |
| <br>
| |
| </li> | | </li> |
| <li>'''RPMの作成''' | | <li>'''ソースの解凍''' |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| [rpmdevel@XXXXX ~]$ rpmbuild -tb --clean httpd-2.4.39.tar.bz2 | | [root@XXXXX ~]# cd /usr/local/src |
| </syntaxhighlight > | | [root@XXXXX ~]# tar zxvf subversion-1.12.0.tar.gz |
| 依存性についてエラーが表示される。
| | </syntaxhighlight> |
| | </li> |
| | <li>'''SQLiteのソースを移動''' |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| エラー: ビルド依存性の失敗:
| | [root@XXXXX ~]# cd /usr/local/src |
| pcre-devel >= 5.0 は httpd-2.4.39-1.i686 に必要とされています
| | [root@XXXXX ~]# mv sqlite-amalgamation-3280000 subversion-1.12.0/sqlite-amalgamation |
| lua-devel は httpd-2.4.39-1.i686 に必要とされています
| | </syntaxhighlight> |
| libxml2-devel は httpd-2.4.39-1.i686 に必要とされています
| | 準備で取得・解凍しておいたSQLiteのCソースコードをsubversionのソースディレクトリに移動する。 |
| </syntaxhighlight >
| | </li> |
| yumで足りないものをインストール
| | <li>'''コンパイル設定'''<br> |
| <syntaxhighlight lang="bash">
| | ([[Subversion 1.12.0のconfigureヘルプ|configureのヘルプ]]) |
| [rpmdevel@XXXXX ~]$ exit | |
| [root@XXXXX ~]# yum pcre-devel lua-devel libxml2-devel | |
| </syntaxhighlight > | |
| 再度RPMをビルド
| |
| <syntaxhighlight lang="bash"> | |
| [root@XXXXX ~]# su - rpmdevel
| |
| [rpmdevel@XXXXX ~]$ cd /home/rpmdevel/src
| |
| [rpmdevel@XXXXX ~]$ rpmbuild -tb --clean httpd-2.4.39.tar.bz2
| |
| </syntaxhighlight >
| |
| 今度はビルドエラーが出る
| |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| RPM ビルドエラー:
| | [root@XXXXX ~]# cd /usr/local/src/subversion-1.12.0 |
| インストール済み(ただし未伸張)ファイルが見つかりました:
| | [root@XXXXX ~]# ./configure \ |
| /usr/lib/httpd/modules/mod_socache_redis.so
| | > --prefix=/usr/subversion-1.12.0 \ |
| </syntaxhighlight >
| | > --without-berkeley-db \ |
| specファイルを編集
| | > --with-apr=/usr/bin/apr-1-config \ |
| <syntaxhighlight lang="bash">
| | > --with-apr-util=/usr/bin/apu-1-config \ |
| [rpmdevel@XXXXX ~]$ tar jxvf httpd-2.4.39.tar.bz2 | | > --with-apxs=/usr/bin/apxs \ |
| [rpmdevel@XXXXX ~]$ vi httpd-2.4.39/httpd.spec | | > --with-lz4=internal \ |
| | | > --with-utf8proc=internal |
| ~(略)~ | | </syntaxhighlight> |
| %files | | (※httpdはRPMでインストール。) |
| ~(略)~ | |
| %{_libdir}/httpd/modules/mod_watchdog.so
| |
| %{_libdir}/httpd/modules/mod_socache_redis.so ←追加 | |
| </syntaxhighlight >
| |
| 再圧縮
| |
| <syntaxhighlight lang="bash">
| |
| [rpmdevel@XXXXX ~]$ tar jcvf httpd-2.4.39.tar.bz2 httpd-2.4.39/ | |
| </syntaxhighlight >
| |
| 再度RPMをビルド
| |
| <syntaxhighlight lang="bash">
| |
| [rpmdevel@XXXXX ~]$ rpmbuild -tb --clean httpd-2.4.39.tar.bz2 | |
| </syntaxhighlight > | |
| | |
| <br>
| |
| </li> | | </li> |
| <li>'''インストール''' | | <li>'''インストール''' |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| [rpmdevel@XXXXX ~]$ cd /home/rpmdevel/rpm/RPMS/i686 | | [root@XXXXX ~]# make |
| [rpmdevel@XXXXX ~]$ sudo rpm -Uvh httpd-2.4.39-1.i686.rpm | | [root@XXXXX ~]# make install |
| [rpmdevel@XXXXX ~]$ sudo rpm -Uvh httpd-devel-2.4.39-1.i686.rpm
| | </syntaxhighlight> |
| [rpmdevel@XXXXX ~]$ sudo rpm -Uvh mod_ssl-2.4.39-1.i686.rpm
| |
| </syntaxhighlight > | |
| <br>
| |
| </li> | | </li> |
| </ol>
| | <li>'''シンボリックリンクの作成''' |
| ==初期設定==
| |
| <ol>
| |
| <li>'''httpd.confの設定''' | |
| <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| [root@XXXXX ~]# vi /etc/httpd/conf/httpd.conf | | [root@XXXXX ~]# ln -s /usr/subversion-1.12.0 /usr/subversion |
| </syntaxhighlight >
| | </syntaxhighlight> |
| <br>
| |
| ユーザーとグループの変更
| |
| <syntaxhighlight lang="vim">
| |
| User daemon
| |
| Group daemon
| |
| ↓
| |
| User apache
| |
| Group apache
| |
| </syntaxhighlight >
| |
| <br>
| |
| サーバー名の設定
| |
| <syntaxhighlight lang="vim">
| |
| ServerName www.example.com:80
| |
| ↓
| |
| ServerName XXXXXXXXXXX:80
| |
| </syntaxhighlight > | |
| <br>
| |
| </li> | | </li> |
| <li>'''SSL対応設定''' | | </ol> |
| <ol>
| |
| <li>'''認証局(CA)の構築'''
| |
| * 秘密鍵と証明書の作成
| |
| CA.shという用意されたスクリプトを使用
| |
| <syntaxhighlight lang="bash">
| |
| [root@XXXXX ~]# cd /etc/pki/tls
| |
| [root@XXXXX ~]# cp misc/CA .
| |
| [root@XXXXX ~]# ./CA -newca
| |
|
| |
| CA certificate filename (or enter to create) ← 空Enter
| |
| Making CA certificate ...
| |
| Generating a 1024 bit RSA private key
| |
| .....++++++
| |
| ................++++++
| |
| writing new private key to '/etc/pki/CA/private/./cakey.pem'
| |
| Enter PEM pass phrase: ← 秘密鍵のパスフレーズを入力
| |
| Verifying password - Enter PEM pass phrase: ← もう一度入力
| |
| -----
| |
| You are about to be asked to enter information that will be incorporated
| |
| into your certificate request.
| |
| What you are about to enter is what is called a Distinguished Name or a DN.
| |
| There are quite a few fields but you can leave some blank
| |
| For some fields there will be a default value,
| |
| If you enter '.', the field will be left blank.
| |
| -----
| |
| Country Name (2 letter code) [AU]: ← JP
| |
| State or Province Name (full name) [Some-State]: ← 県名
| |
| Locality Name (eg, city) []: ← 市町村
| |
| Organization Name (eg, company) [Internet Widgits Pty Ltd]:← 社名
| |
| Organizational Unit Name (eg, section) []: ← 部署
| |
| Common Name (eg, YOUR name) []: ← (※)
| |
| Email Address []: ← メルアド
| |
| Please enter the following 'extra' attributes
| |
| to be sent with your certificate request
| |
| A challenge password []: ← 空Enter
| |
| An optional company name []: ← 空Enter
| |
| Enter pass phrase for /etc/pki/CA/private/./cakey.pem: ← 秘密鍵のパスフレーズを入力
| |
| </syntaxhighlight >
| |
| <br>
| |
| (※)サーバのURL(またはサーバ名?)にしないとApacheLogに警告が出力されてた。
| |
| 以上の処理により、~
| |
| ~
| |
| /etc/pki/CA/cacert.pem ← 自己署名型CA証明書~
| |
| /etc/pki/CA/private/cakey.pem ← 秘密鍵~
| |
| ~
| |
| が作成される。~
| |
| 秘密鍵は他人に見られないように
| |
| # chmod 600 /etc/pki/CA/private/cakey.pem
| |
| # chmod 700 /etc/pki/CA/private
| |
| とパーミッションを設定しておく。~
| |
| 証明書を確認するには以下のようにする。
| |
| # openssl x509 -in /etc/pki/CA/cacert.pem -text
| |
| | |
| **SSLサーバ構築 [#p4db68bc]
| |
| -サーバ秘密鍵の作成
| |
| # openssl genrsa -out server.key 1024
| |
| Generating RSA private key, 1024 bit long modules
| |
| .............++++++
| |
| ....++++++
| |
| e is 65537 (0x10001)
| |
| 確認
| |
| # ls
| |
| server.key
| |
| -証明書署名要求(CSR)の作成
| |
| # openssl req -new -key server.key -out server.csr
| |
| You are about to be asked to enter information that will be incorporated
| |
| into your certificate request.
| |
| What you are about to enter is what is called a Distinguished Name or a DN.
| |
| There are quite a few fields but you can leave some blank
| |
| For some fields there will be a default value,
| |
| If you enter '.', the field will be left blank.
| |
| -----
| |
| Country Name (2 letter code) [AU]: ← JP
| |
| State or Province Name (full name) [Some-State]: ← 県名
| |
| Locality Name (eg, city) []: ← 市町村
| |
| Organization Name (eg, company) [Internet Widgits Pty Ltd]:← 社名
| |
| Organizational Unit Name (eg, section) []: ← 部署
| |
| Common Name (eg, YOUR name) []: ← (※)
| |
| Email Address []: ← メルアド
| |
| Please enter the following 'extra' attributes
| |
| to be sent with your certificate request
| |
| A challenge password []: ← 空Enter
| |
| An optional company name []: ← 空Enter
| |
|
| |
| (※)サーバのURL(またはサーバ名?)にしないとApacheLogに警告が出力されてた。
| |
| 確認
| |
| # ls
| |
| server.key server.csr
| |
| -証明書への自己署名
| |
| # echo 01 > ca-cert.srl
| |
| # openssl x509 -CA ../CA/cacert.pem -CAkey ../CA/private/cakey.pem -CAserial ca-cert.srl -req -days 3650 -in server.csr -out server.crt
| |
| Using configuration from /etc/pki/tls/openssl.cnf
| |
| Enter pass phrase for /etc/pki/CA/private/cakey.pem: ← 秘密鍵のパスフレーズを入力
| |
| 確認
| |
| # ls
| |
| server.key server.csr server.crt
| |
| 秘密鍵と証明書を移動する。
| |
| # mkdir /etc/httpd/conf/ssl
| |
| # mv server.key /etc/httpd/conf/ssl
| |
| # mv server.crt /etc/httpd/conf/ssl
| |
| | |
| **Apacheへの埋め込み [#fb362adc]
| |
| -''httpd-ssl.confの設定''
| |
| # vi /etc/httpd/conf/extra/httpd-ssl.conf
| |
| サーバー名
| |
| <VirtualHost _default_:443>
| |
| ServerName www.example.com:443
| |
| ↓
| |
| ServerName XXXXXXXXXXXXXXX:443
| |
| サーバー証明書のパス
| |
| SSLCertificateFile "/etc/httpd/conf/server.crt"
| |
| ↓
| |
| SSLCertificateFile "/etc/httpd/conf/ssl/server.crt"
| |
| 秘密鍵のパス
| |
| SSLCertificateKeyFile "/etc/httpd/conf/server.key"
| |
| ↓
| |
| SSLCertificateKeyFile "/etc/httpd/conf/ssl/server.key"
| |
| -''httpd.confの設定''
| |
| SSL用設定ファイルの有効化
| |
| # vi /etc/httpd/conf/httpd.conf
| |
| SSL設定ファイルのリンク
| |
| # Secure (SSL/TLS) connections
| |
| #Include conf/extra/httpd-ssl.conf
| |
| ↓
| |
| Include conf/extra/httpd-ssl.conf ← コメント外す
| |
| 確認
| |
| # /usr/sbin/apachectl configtest
| |
| Syntax OK
| |
|
| |
| *起動 [#l58249df]
| |
| 下記のコマンドで起動、停止、再起動を行う
| |
| # /usr/sbin/apachectl start ← 起動
| |
| # /usr/sbin/apachectl stop ← 停止
| |
| # /usr/sbin/apachectl restart ← 再起動
| |
| | |
| *動作確認 [#z82ab4b3]
| |
| http,httpsでそれぞれアクセスし「It works!」が表示されればOK。~
| |
| ~
| |
| *自動起動設定 [#l37381a1]
| |
| # chkconfig httpd on
| |
| ~
| |
| *有効にしているモジュール [#ye1b3c2d]
| |
| 大層な数のモジュールが動作しているので、下記に限定して他は無効化。~
| |
| (とりあえず)~
| |
| LoadModule authz_host_module /usr/lib/httpd/modules/mod_authz_host.so
| |
| →[[http://httpd.apache.org/docs/2.2/ja/mod/mod_authz_host.html authz_host_module]] のドキュメント~
| |
| ~
| |
| LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so
| |
| →[[log_config_module>http://httpd.apache.org/docs/2.2/ja/mod/mod_log_config.html]] のドキュメント~
| |
| ~
| |
| LoadModule setenvif_module /usr/lib/httpd/modules/mod_setenvif.so
| |
| →[[setenvif_module>http://httpd.apache.org/docs/2.2/ja/mod/mod_setenvif.html]] のドキュメント~
| |
| ~
| |
| LoadModule ssl_module /usr/lib/httpd/modules/mod_ssl.so
| |
| →[[ssl_module>http://httpd.apache.org/docs/2.2/ja/mod/mod_ssl.html]] のドキュメント~
| |
| ~
| |
| LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so
| |
| →[[mime_module>http://httpd.apache.org/docs/2.2/ja/mod/mod_mime.html]] のドキュメント~
| |
| ~
| |
| LoadModule dav_module /usr/lib/httpd/modules/mod_dav.so
| |
| →[[dav_module>http://httpd.apache.org/docs/2.2/ja/mod/mod_dav.html]] のドキュメント~
| |
| ~
| |
| LoadModule dav_fs_module /usr/lib/httpd/modules/mod_dav_fs.so
| |
| →[[dav_fs_module>http://httpd.apache.org/docs/2.2/ja/mod/mod_dav_fs.html]] のドキュメント~
| |
| ~
| |
| LoadModule rewrite_module /usr/lib/httpd/modules/mod_rewrite.so
| |
| →[[rewrite_module>http://httpd.apache.org/docs/2.2/ja/mod/mod_rewrite.html]] のドキュメント~
| |
| ~
| |
| LoadModule dav_svn_module /usr/lib/httpd/modules/mod_dav_svn.so
| |
| →[[dav_svn_module>http://www.caldron.jp/~nabetaro/svn/svnbook-1.5-final/html-chunk/svn.ref.mod_dav_svn.conf.html]] のドキュメント~
| |
| ~
| |