環境構築
mkdir /root/backup
mv /etc/yum.repos.d/* /root/backup/
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirror.centos.org/centos/7/os/x86_64/
curl -o /etc/yum.repos.d/EPEL.repo http://download.fedoraproject.org/pub/epel/7/x86_64/
curl -o /etc/yum.repos.d/REMI.repo https://rpms.remirepo.net/enterprise/remi.repo
yum clean all
rm -rf /var/cache/yum/x86_64/7/*
yum makecache
REMIリポジトリ設定ファイルを調整する場合:
# ファイル: remi-config
s@^#baseurl=http://rpms.remirepo.net@baseurl=https://ftp.riken.jp/Linux/remi/enterprise/@g
sed -i -f remi-config /etc/yum.repos.d/REMI.repo
LAMPスタックのインストール
yum -y install vim bzip2 bash-completion nginx mariadb-server php-opcache php-cli php-mysqlnd php-xml php-mbstring php-intl php-gd php-zip php-fpm
MariaDBの初期設定
systemctl start mariadb
mysql_secure_installation
mysql -uroot -pPass123 <<EOF
CREATE DATABASE cloudstore;
GRANT ALL PRIVILEGES ON cloudstore.* TO 'clouduser'@'localhost' IDENTIFIED BY 'Pass123';
FLUSH PRIVILEGES;
EXIT;
EOF
</code>
nginxの設定
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
サービスの起動とファイアウォール設定
systemctl start nginx
systemctl start php-fpm
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
ownCloudのインストール
tar -xf owncloud-10.2.0.tar.bz2 -C /usr/share/nginx/html/
chown -R nobody:nobody /usr/share/nginx/html/owncloud
mkdir /usr/share/nginx/html/owncloud/data /usr/share/nginx/html/owncloud/apps-external
chown -R apache:apache /usr/share/nginx/html/owncloud/{data,apps,apps-external,config}
chmod 775 /usr/share/nginx/html/owncloud/{apps,config}
semanage fcontext -a -t httpd_sys_rw_content_t '/usr/share/nginx/html/owncloud/data(/.*)?'
restorecon -Rv '/usr/share/nginx/html/owncloud/'