조금 오래된 환경을 준비했다.

검증을 위해 조금 오래된 환경을 준비했기 때문에 비망록. 컨테이너가 아닌 가상 머신에서 작업했습니다.
apache와 php는 config.nice를 사용하여 컴파일했습니다.
Python27이나 새로운 Ansible2.9의 설치에는 한 궁리 필요했다.

만들려는 환경


  • CentOS 6.8
  • Apache 2.2
  • PHP 5.2
  • Python2.7 (아무것도하지 않으면 2.6 포함)
  • Ansible2.9 (yum에서는 들어 가지 않는다)

  • CentOS 6.8



    아래의 아카이브를 사용했다. CentOS-6.8-x86_64-minimal.iso를 이용.
    htp //ftp. 리켄. jp/ぃぬx/せんとsーゔぁるlt/6.8/이자 s/x86_64/

    이쪽에도 아카이브는 있지만 다운로드에 시간이 걸리고 사용할 수 없었다.
    htps : // 아 r ゔ ぇ. 케 r네 l. 오 rg / 센토 s ゔ ぁ lt /

    잘 하는 것 (하고 있던 것)


  • IPv6 비활성화
  • ifcfg-ethX의 HWADDR이나 UUID 코멘트 아웃, ONBOOT=yes로 한다
  • IP 소통할 수 없을 때는 /etc/udev/rules.d/70-persistent-net.rules 삭제하고 OS 재부팅.
  • SELinux 무효화

    yum 설정



    yum 명령을 사용할 수 있도록 /etc/yum.repos.d/CentOS-Base.repo를 편집했습니다.

    기존 mirrorlist를 주석 처리. baseurl도 archive.kernel.org의 6.8 사양으로 다시 작성했습니다.
    [base]
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
    baseurl=http://archive.kernel.org/centos-vault/6.8/os/$basearch/
    
    [updates]
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
    baseurl=http://archive.kernel.org/centos-vault/6.8/updates/$basearch/
    
    [extras]
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
    baseurl=http://archive.kernel.org/centos-vault/6.8/extras/$basearch/
    
    [centosplus]
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
    baseurl=http://archive.kernel.org/centos-vault/6.8/centosplus/$basearch/
    
    [contrib]
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
    #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
    baseurl=http://archive.kernel.org/centos-vault/6.8/contrib/$basearch/
    

    OS 버전 고정



    /etc/yum/vars/releasever를 준비하고 6.8로만 써 두고 yum update했다.

    /etc/yum/vars/releasever 만들기
    # vi /etc/yum/vars/releasever
    ---内容ここから---
    6.8
    ---ここまで---
    
    # yum update
    

    이들도 넣어


     # yum install wget make which
    

    Apache2.2



    다운로드는 이쪽의 아카이브를 사용했다
    htps : // 아 r ゔ ぇ. 아파치. rg / st / htpd / htpd-2.2.29. r. gz

    configure했을 때에 몇번이나 나온 에러에 각각 대처로 필요했던 것.

    필요했던 것
    # yum install gcc glibc g++ zlib zlib-devel openssl-devel
    

    다운로드
    # cd /usr/local/src
    # wget https://archive.apache.org/dist/httpd/httpd-2.2.29.tar.gz
    # tar zxf httpd-2.2.29.tar.gz
    # cd httpd-2.2.29
    

    오래된 환경에 있었다 /usr/local/src/httpd-2.2.29/config.nice의 내용을 복사.
    vi config.nice
    config.nice
    #! /bin/sh
    #
    # Created by configure
    
    "./configure" \
    "--enable-so" \
    "--enable-ssl" \
    "--enable-mods-shared=all" \
    "--with-expat=builtin" \
    "--with-included-apr" \
    "$@"
    

    설치
    # sh config.nice
    # make
    # make install
    

    그룹 및 사용자 추가
    # groupadd -g 48 apache
    # useradd -g apache -u 48 apache
    

    httpd.conf 편집


    # vi /usr/local/apache2/conf/httpd.conf
    ---とりあえず3箇所編集---
    User apache
    Group apache
    ServerName サーバーのホストネーム:80
    ---
    

    동작 확인


    # /usr/local/apache2/bin/apachectl configtest
    # /usr/local/apache2/bin/apachectl start
    
    iptablesを止めるか、80番をあけてから
    ブラウザで http://[サーバーのIP]/ にアクセス、It Works!を確認。
    

    PHP5.2



    configure했을 때에 몇번이나 나온 에러에 각각 대처해 필요했던 것.

    필요했던 것_그 1
    # yum install libxml2 libxml2-devel libcurl libcurl-devel
    # yum install gcc-c++
    
    (参考)http://re2c.org/install/install.html#build-cmake
    # cd /usr/local/src
    # wget https://github.com/skvadrik/re2c/releases/download/0.13.6/re2c-0.13.6.tar.gz
    # gunzip re2c-0.13.6.tar.gz
    # tar xvf re2c-0.13.6.tar
    # cd re2c-0.13.6
    # ./configure
    # make
    # make install
    

    필요했던 것_그 2
    (参考)https://qiita.com/soundws/items/cc84da42419f1ab3443b
    # cd ~
    # wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
    # rpm --import RPM-GPG-KEY-EPEL-6 
    # rm -f RPM-GPG-KEY-EPEL-6 
    
    # vi /etc/yum.repos.d/epel.repo
    
    ---内容ここから---
    [epel]
    name=EPEL RPM Repository for Red Hat Enterprise Linux
    baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/
    gpgcheck=1
    enabled=0
    ---ここまで---
    
    # yum --enablerepo=epel install libmcrypt-devel
      これをしないと出たエラー:configure: error: mcrypt.h not found. Please reinstall libmcrypt.
    
    # yum --enablerepo=epel install mysql-devel
      これをしないと出たエラー
    configure: error: Cannot find MySQL header files under /usr/bin/mysql.
    Note that the MySQL client library is not bundled anymore!
    

    필요했던 것_3
    # vi /usr/local/apache2/bin/apxs
    一行目を
    #!/usr/bin/perl -w
    にする
    
     (参考)https://orebibou.com/ja/home/201506/20150617_001/
    

    php 설치
    # cd /usr/local/src
    # wget https://museum.php.net/php5/php-5.2.17.tar.gz
    # tar zxf php-5.2.17.tar.gz
    # cd php-5.2.17
    # vi config.nice
    ---内容ここから---
    #! /bin/sh
    #
    # Created by configure
    
    './configure' \
    '--with-apxs2=/usr/local/apache2/bin/apxs' \
    '--with-mysql=/usr/bin/mysql' \
    '--with-mcrypt' \
    '--with-curl=/usr/local/bin' \
    '--with-zlib' \
    '--with-openssl' \
    '--enable-mbstring' \
    '--enable-mbregex' \
    '--enable-force-cgi-redirect' \
    '--disable-short-tags' \
    '--with-libdir=lib64' \
    "$@"
    ---ここまで---
    
    # sh config.nice
    # make
    # make install
    

    아파치와 php의 협력



    아파치 측


    # vi /usr/local/apache2/conf/httpd.conf
    ---
    <IfModule mime_module>
        TypesConfig conf/mime.types
        AddType application/x-compress .Z
        AddType application/x-gzip .gz .tgz
        AddType application/x-httpd-php .php ##### このAddTypeを追加 ####
    </IfModule>
    ---
    

    httpd.conf에 LoadModule php5_module modules/libphp5.so가 있는지도 확인. 없는 경우 106행째에 추가.

    재부팅(restart를 사용할 수 없음)
    # /usr/local/apache2/bin/apachectl stop
    # /usr/local/apache2/bin/apachectl configtest
    # /usr/local/apache2/bin/apachectl start
    

    php측



    php.ini는 최종적으로는 낡은 환경으로부터 가져오지만, 우선 동작 확인을 위해 이하만 실시. 코멘트;를 떼어낼 뿐의 개소도 있다.
    # cp -p /usr/local/src/php.ini-recommended /usr/local/lib/php.ini
    # vi /usr/local/lib/php.ini
    
    ---変更したところ--- 
    output_buffering = On
    error_reporting = E_ALL & ~E_NOTICE
    default_charset = "UTF-8"
    include_path = ".:/usr/local/include/php:/usr/local/lib"
    extension_dir = "/usr/local/lib/php/ext"
    date.timezone = Asia/Tokyo
    mbstring.language = Japanese
    mbstring.internal_encoding = UTF-8
    mbstring.http_input = auto
    mbstring.http_output = pass
    mbstring.encoding_translation = Off
    mbstring.detect_order = UTF-8, SJIS, EUC-JP, JIS, ASCII
    mbstring.substitute_character = none;
    ------
    

    동작 확인


    # vi /usr/local/apache2/htdocs/info.php
    ---内容ここから---
    <?php phpinfo(); ?>
    ---ここまで---
    
    ブラウザで http://[サーバーのIP]/info.php にアクセス
    

    표시 확인


    Python2.7 및 Ansible2.9.5



    필요했던 것
    # yum install centos-release-scl-rh scl-utils scl-utils-build
    

    Python27_설치
    # yum install python27
    

    확인 (이 시점에서는 여전히 python26)
    # which python
    /usr/bin/python
    
    # python --version
    Python 2.6.6
    
    # pip --version
    -bash: pip: コマンドが見つかりません
    

    python27을 사용하도록 설정
    # scl enable python27 bash
    
    # which python
    /opt/rh/python27/root/usr/bin/python
    
    # python --version
    Python 2.7.17
    
    # pip --version
    pip 8.1.2 from /opt/rh/python27/root/usr/lib/python2.7/site-packages (python 2.7)
    

    ansible2.9.5 설치
    # pip install ansible==2.9.5
    
    # 確認
    # ansible --version
    /opt/rh/python27/root/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:41: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
      from cryptography.exceptions import InvalidSignature
    ansible 2.9.5
      config file = None
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /opt/rh/python27/root/usr/lib/python2.7/site-packages/ansible
      executable location = /opt/rh/python27/root/usr/bin/ansible
      python version = 2.7.17 (default, Nov 29 2019, 13:22:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]
    

    python27을 OS 시작시 사용할 수 있도록하십시오.
    # vi /etc/profile.d/python27.sh
    ---内容ここから---
    source /opt/rh/python27/enable
    ---ここまで---
    

    ansible 런타임에 필요한 것
    # yum install ibselinux-python  ##(参考)https://kokichiblog.com/it/1003/
    
    ### sshpassインストール
    # rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
    # yum clean all
    # yum --enablerepo=epel install sshpass
    
    ## 上記でも問題なかったけどx86_64のほう選ぶべきだったかも
    ## rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    

    다른 일



    git 버전 1-2


    # yum install -y sqlite-devel bzip2-devel xz-libs gcc g++ build-essential kernel-headers kernel-devel
    # yum install -y gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker
    
    # cd /usr/local/src
    # wget https://www.kernel.org/pub/software/scm/git/git-2.29.2.tar.gz 
    # tar zxf git-2.29.2.tar.gz
    # cd git-2.29.2
    # make prefix=/usr/local all
    # make prefix=/usr/local install
    

    VSCode에서 CentOS6에 Remote-SSH 할 때 필요한 것



    쓸 수 없는 것


  • SELinux를 비활성화하면 Apahce 시작시 경고가 발생합니다.
  • [Sun Nov 29 15:41:40 2020] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Nov 29 15:41:40 2020] [notice] Digest: generating secret for digest authentication ...
    [Sun Nov 29 15:41:40 2020] [notice] Digest: done
    [Sun Nov 29 15:41:41 2020] [notice] Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips DAV/2 configured -- resuming normal operations
    
  • Ansible 실행할 때마다 경고가 발생합니다
  • CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. 
    Support for it is now deprecated in cryptography, and will be removed in a future release.
      from cryptography.exceptions import InvalidSignature
    
  • 설치 이유 잊어버리기
  • yum install libstdc++

  • 좋은 웹페이지 즐겨찾기