CentOS7 安装ownCloud
ownCloud的安裝依賴LAMP環境,即 Linux + Apache +? MySQL(Mariadb) + PHP,所以在裝owncloud前最好先裝好這些,并且保證已經可用。
??? 為了方便,本文在運行shell命令時都是以管理員用戶身份運行(root權限下運行)!!!
具體步驟:
????這里重申一下,為免麻煩,以下命令都是以管理員用戶的身份運行的,root權限下執行的!
1.?開放防火墻
setenforce 0 sed -i 's/enforcing/disabled/' /etc/selinux/config systemctl disable --now firewalld reboot2.?安裝php 7.2 +?apahce?運行環境
yum install centos-release-scl-rh -y # yum search php yum install rh-php72 -y yum install rh-php72 rh-php72-php rh-php72-php-gd rh-php72-php-mbstring rh-php72-php-intl rh-php72-php-pecl-apcu -y yum install rh-php72-php-mysqlnd -y scl -l scl enable rh-php72 "php -v" scl enable rh-php72 bash php -v php -myum install -y httpd systemctl start httpd systemctl enabled httpdln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php72-php.conf /etc/httpd/conf.d/ ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php72-php.conf /etc/httpd/conf.modules.d/ ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php72-php7.so /etc/httpd/modules/systemctl restart httpd3.? 下載owncloud包
??? 去owncloud官網?https://download.owncloud.org/community/owncloud-10.5.0.tar.bz2??下載包并解壓,解壓后的包文件夾名稱應該也是owncloud
? ?解壓安裝
yum install bzip2 lrzsz -y mkdir -p /var/www/html/owncloud tar -xjvf owncloud-10.5.0.tar.bz2 cd owncloud yes | cp -r * /var/www/html/owncloud/ chown -R apache:apache /var/www/html/owncloud chmod -R 777 /var/www/html/owncloud chcon -v -R -u system_u -r object_r -t httpd_sys_content_t '/var/www/html/owncloud/' chcon -R -t httpd_sys_rw_content_t '/var/www/html/owncloud/config/' chcon -R -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps/' cd /var/www/html/owncloud mkdir data chown -R apache:apache /var/www/html/owncloud/ chcon -v -R -u system_u -r object_r -t httpd_sys_content_t '/var/www/html/owncloud/' chcon -R -t httpd_sys_rw_content_t '/var/www/html/owncloud/data/' chcon -R -t httpd_sys_rw_content_t '/var/www/html/owncloud/config/' chcon -R -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps/' systemctl restart httpd3,安裝mysql數據庫
yum -y install wget gcc gcc-c++ ncurses ncurses-devel cmake numactl.x86_64 libaio wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz tar -zxvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ mv /usr/local/mysql-5.7.24-linux-glibc2.12-x86_64/ /usr/local/mysql cd /usr/local/mysql/ cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql cat >/etc/my.cnf <<EOF [client] port=3306 socket=/tmp/mysql.sock [mysqld] port=3306 socket=/tmp/mysql.sock skip-external-locking key_buffer_size = 38M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M basedir=/usr/local/mysql datadir=/var/lib/mysql bind-address=0.0.0.0 innodb_flush_log_at_trx_commit=1 sync_binlog=1 log-bin=/var/lib/mysql/mysql_logbin log-error=/var/log/mariadb slow_query_log =1 slow_query_log_file=/tmp/mysql_slow.log server-id=1 symbolic-links=0 [mysqld_safe] pid-file=/var/run/mariadb/mariadb.pid EOFuseradd mysql mkdir -p /var/lib/mysql chown mysql:mysql /var/lib/mysql mkdir -p /var/log/mariadb chown mysql:mysql /var/log/mariadb/ mkdir -p /var/run/mariadb chown mysql:mysql /var/run/mariadb/ touch /var/run/mariadb/mariadb.pid cat >> /etc/profile << EOF export PATH=\$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib EOF source /etc/profile chmod -R 777 /var/log mysqld --defaults-file=/etc/my.cnf --user=mysql --initialize-insecure /etc/init.d/mysql startmysql -u root -p update mysql.user set authentication_string=password('123456') where user='root'; flush privileges;ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock登錄owncloud,創建管理員用戶,訪問:http://192.168.225.194/owncloud/?
?
? ??【注意!】??圖4這步包括以下內容:1.?創建owncloud的管理員用戶(Create an admin account)。2.?數據存儲文件夾(Data folder)。這里默認文件夾就可以了,不用管。??3.?配置數據庫,包括數據庫類型的選擇,對應的用戶、密碼、數據庫配置。這里默認是SQLite數據庫類型,如果要用MySQL或者MariaDB的,這里一定要配置一下。如果忘記配置了,可以參考博文《如何將owncloud的數據庫從SQLite遷移到MySQL/MariaDB》遷移數據庫。
4 . 本機登錄看看
圖4. 登錄owncloud
8. 配置trusted_domains
??? 在其他電腦上訪問服務器(假設IP為198.12.12.6),提示需要配置trusted_domains。
圖5. 配置trusted_domains
??? 從圖片中的提示可以看出來,需要在服務器上配置/var/www/html/owncloud/config/config.php文件,并且在同一個文件夾下有一個配置的示例文件config.sample.php可供參考。
vim /var/www/html/owncloud/config/config.php圖6. 修改配置文件trusted_domains
??? 前5行都不要動,在第8行? 0 => 'c1loud.frankgreg.com',? 這一行后面添加如下一句(假設服務器IP為192.12.12.6)
1 => '192.12.12.6',??? 重啟httpd服務,完工。
systemctl restart httpd總結
以上是生活随笔為你收集整理的CentOS7 安装ownCloud的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CentOS7 shell脚本安装jdk
- 下一篇: ElasticSearch可视化工具De