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

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

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