Centos7 Builds owncloud Cloud Storage

Beginning of this article: https://www.somata.work/2019/Centos7SetupOwncloudCloudStorage.html

Prepare the necessary software and data first. Here I've sorted it out:
Baidu Cloud Sharing
But it's best to go online and online by yourself.Here's just a shortcut.
owncloud: https://www.owncloud.org

Installation of vmware and virtual machines will not be demonstrated.Let's start by demonstrating the installation of the LAMP environment and owncloud.
It is recommended to connect to the virtual machine remotely using putty or other ssh software and start typing commands.It is easier to operate than directly in a virtual machine.
I use xshell for remote connection here.The effect is the same don't care

Configure domestic yum sources

mkdir /root/back
mv /etc/yum.repos.d/* /root/back/    # Backup yum source
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #Configure domestic yum sources
curl -o /etc/yum.repos.d/CentOS-epel.repo http://mirrors.aliyun.com/repo/epel-7.repo #Add extended yun source
curl -o /etc/yum.repos.d/CentOS-remi.repo https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi.repo #Add php source
yum clean all    # Clear the original cache
rm -rf /var/cache/yum/x86_64/7/*    # Remove cache completely
yum makecache    # Create a new cache

The remi profile may not necessarily use domestic sources, but here are some other improvements to the remi profile to force it into effect:

# file: rule

s@mirrorlist@#mirrorlist@g
s@#baseurl=http://rpms.remirepo.net@baseurl=http://mirrors.tuna.tsinghua.edu.cn/remi@g
sed -i -f rule  /etc/yum.repos.d/CentOS-remi.repo

Install LAMP environment

yum -y install vim bzip2 bash-completion httpd mariadb mariadb-server php70-php php70-php-mysqlnd php70-php-cli php70-php-xml php70-php-mbstring php70-php-intl php70-php-gd php70-php-pecl-zip      # Install necessary software

Configuration to make the LAMP environment effective

Configure the mariadb database first.

systemctl start mariadb # Start the database
mysql_secure_installation   # Use commands to quickly set up a database

# Enter mysql to create database user
mysql -uroot -p123456    # -p followed by the set user password
> CREATE DATABASE owncloud;     # Create a database
> GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY '123456';    # Create users and corresponding user privileges
> FLUSH PRIVILEGES;        # Refresh Permissions
> exit

Then configure apache WEB service

systemctl start httpd        # service httpd start
systemctl enable httpd        # Set boot-up self-starting httpd
systemctl enable mariadb    # Set to turn on self-starting mariadb
firewall-cmd --permanent --add-service=http    # Configuration adds service policies to files.Make it permanent
firewall-cmd --reload           # Reload Firewall Configuration

Loading owncloud clouds

First import the downloaded owncloud-10.2.0.tar.bz2 into the virtual machine.
I use the sftp command that comes with xshell to transfer files here.If putty is used, psftp.exe can be used.Note that the software does not support graphics and needs to be executed from the command line.Detailed Usage Self-Baidu

# Enter the location to upload owncloud files
tar -xf owncloud-10.2.0.tar.bz2 -C /var/www/html/    # Unzip Web Page
# Adjust the default owncloud permissions
chown nobody:nobody -R /var/www/html/owncloud    # The modification owner is nobody, not apache. There are many files with write permissions inside.Can't let Apache own
mkdir data apps-external    # Manual File Creation
chown apache:apache data apps apps-external config    # Set these files as apache permissions
chmod 775 apps config    # 2 file permission configurations
# Configure SELinux-related permissions
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps-external(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.user.ini'
restorecon -Rv '/var/www/html/owncloud/'
chcon -R -u system_u /var/www/html/owncloud

Go to the web page and continue configuring owncloud

Complete all configurations.You can start normal access.

Log in based on the previously configured administrative user.

This article has been certified as "original". Author Qian Kun Pan visited yuanben.io to get authorization information.

Tags: Linux yum PHP MariaDB Database

Posted on Thu, 09 Jan 2020 14:11:44 -0500 by gazalec