Linuxめも

日本語化

# localectl set-locale LANG=ja_JP.UTF-8
# source /etc/locale.conf 

SELinuxを無効化

# vi /etc/sysconfig/selinux
#SELINUX=enforcing
SELINUX=disabled

サーバを再起動

vsftpdのインストール

# yum install vsftpd
# vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
ascii_upload_enable=YES
ascii_download_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
ls_recurse_enable=YES
use_localtime=YES
# touch /etc/vsftpd/chroot_list
# chmod 600 /etc/vsftpd/chroot_list
# /etc/rc.d/init.d/vsftpd start

自動起動設定

# chkconfig vsftpd on

設定確認

# chkconfig --list vsftpd

PostgreSQLのインストール

# yum install postgresql-server

自動起動設定

# chkconfig postgresql on

データベースの初期化

# su postgres
$ initdb --encoding=UTF8 --no-locale -D /var/lib/pgsql/data

起動

# /etc/rc.d/init.d/postgresql start

無ければ

# service postgresql start

MySQLのインストール

# yum install mysql mysql-devel mysql-server
# /etc/rc.d/init.d/mysqld start

自動起動設定

# chkconfig mysqld on

コンソール経由で文字化けする場合

設定ファイルに2行を追加してMySQLを再起動

# vi/etc/my.cnf
[mysqld]
default-character-set=utf8
skip-character-set-client-handshake

MariaDBのインストール

CentOS7からはMySQLと互換性があるMariaDBが標準になっているようです。

# yum install mariadb mariadb-server

起動

# systemctl start mariadb.service

停止

# systemctl stop mariadb.service

自動起動を有効にする

# systemctl enable mariadb.service

確認

# systemctl is-enabled mariadb.service

Apacheのインストール

# yum install httpd

自動起動設定

# chkconfig httpd on

起動

# /etc/rc.d/init.d/httpd start

無ければ

# systemctl start httpd.service

CentOS7の場合、configtestとgracefulはserviceを使用します。

# service httpd configtest
# vi /etc/httpd/conf/httpd.conf
ServerName localhost:80
UseCanonicalName On

<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>

<Directory /home/*/public_html>
    AllowOverride All
    Options FollowSymlinks ExecCGI
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

つながらない場合

firewalldとやらがじゃまをしているらしいので停止

# systemctl stop firewalld

再起動後も自動起動しないようにするためには

# systemctl disable firewalld

エラーになる場合

# yum list
読み込んだプラグイン:fastestmirror
base                                                                                                                 | 3.6 kB  00:00:00


 One of the configured repositories failed (不明),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again

デバッグでログを取ってみる

# URLGRABBER_DEBUG=1 yum check-update 2> /tmp/debug.log

SSLが問題っぽい

* NSS error -12190 (SSL_ERROR_PROTOCOL_VERSION_ALERT)

NSSをupdate

# yum --disablerepo=epel update nss

curlのバージョンが古いことが問題っぽい

# yum --disablerepo=epel update curl

PHPのインストール

# yum install php php-cli php-common php-mbstring php-pdo php-pgsql php-mysql php-gd php-pear php-xml php-intl

PHP7のインストール

# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# yum install --enablerepo=remi,remi-php71 php php-cli php-common php-mbstring php-pdo php-pgsql php-mysql php-gd php-pear php-xml php-intl

PHP7のバージョンアップ

yumでインストールしたPHPのバージョンが 7.0.30 であったので、7.1以降にバージョンアップしてみました。

# yum --enablerepo=remi-php71 install php
# php -v
PHP 7.1.20 (cli) (built: Jul 19 2018 10:10:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

PHP7.3にバージョンアップしてみました。

# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# yum install --enablerepo=remi-php73 php
# php -v
PHP 7.3.12 (cli) (built: Nov 19 2019 10:24:51) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.12, Copyright (c) 1999-2018, by Zend Technologies

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS