{"id":16871,"date":"2015-03-10T09:06:04","date_gmt":"2015-03-10T14:06:04","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=16871"},"modified":"2022-06-03T03:44:28","modified_gmt":"2022-06-03T08:44:28","slug":"how-to-install-owncloud-8-on-a-centos-7-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-owncloud-8-on-a-centos-7-vps\/","title":{"rendered":"How to install ownCloud 8 on a CentOS 7 VPS"},"content":{"rendered":"
ownCloud is an open source web application for data synchronization and file sharing. The latest version of ownCloud brings improved sharing and collaboration and introduces an improved search, faster ways of getting at your files with favorites and provides extremely quick and easy access to important files.<\/p>\n
The installation of ownCloud 8\u00a0on a CentOS 7 VPS<\/a> should take about ten minutes if you follow the very easy steps described below.<\/p>\n <\/p>\n Stop the Apache service and disable it to start on server boot:<\/p>\n Install Nginx and PHP-FPM:<\/p>\n Download the latest version of ownCloud available at https:\/\/download.owncloud.org\/ and extract it to a directory on your server:<\/p>\n The webserver user (nginx) needs to be able to write to files and directories inside the \u2018\/var\/www\/html\/owncloud\u2019 directory, so it can easily be accomplished by executing the following command:<\/p>\n Edit the ‘\/etc\/php-fpm.d\/www.conf’ configuration file and set user and group to nginx:<\/p>\n Create ‘data’ directory outside the document root, so that it is not accessible from the web:<\/p>\n ownCloud 8 requires a database, so create a new database using the following commands:<\/p>\n It is recommended to secure ownCloud with SSL certificate and force ownCloud using HTTPS to encrypt ownCloud traffic. You can purchase a trusted SSL Certificate<\/a>, or create a self-signed SSL certificate using:<\/p>\n Create a new Nginx server block with the following content:<\/p>\n Run the following command to see the ‘session.save_path’ setting:<\/p>\n Change permissions on PHP\u2019s ‘session.save_path’ directory:<\/p>\n Enable the newly created Nginx server block:<\/p>\n Edit Nginx’s main configuration file (\/etc\/nginx\/nginx.conf) and add this line:<\/p>\n to the end of the http {} block, immediately before the server {} block:<\/p>\n Optionally, delete the default server {} block.<\/p>\n Edit the ‘\/etc\/php-fpm.d\/www.conf’ configuration file and change (or comment out) ‘listen = 127.0.0.1:9000’ to ‘listen = \/var\/run\/php5-fpm.sock’ .<\/p>\n Restart PHP-FPM and Nginx services for the changes to take effect:<\/p>\n Set PHP-FPM and Nginx to start on server boot:<\/p>\n Open https:\/\/your-domain.com in your favorite web browser, create an admin account (set admin username and password), change the ‘data’ directory to ‘\/data’ (do not leave the default setting ‘\/var\/www\/html\/owncloud\/data’), click ‘Storage & database’, select MySQL\/MariaDB, enter database info (MariaDB user, password, database and hostname) and click ‘Finish setup’.<\/p>\n That is it, the OwnCloud 8 installation is now complete.<\/p>\n Of course, you don\u2019t have to do any of this if you use one of our CentOS Hosting\u00a0Plans<\/a>, in which case you can simply ask our expert Linux admins to install ownCloud 8 for you. They are available 24×7 and will take care of your request immediately. For updates, you can also try our guide on How to install OwnCloud 7 on an Ubuntu 14.04 VPS<\/a>.<\/p>\n PS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" ownCloud is an open source web application for data synchronization and file sharing. The latest version of ownCloud brings improved … <\/p>\nsystemctl stop httpd\nsystemctl disable httpd<\/pre>\n
yum install nginx php-fpm php-cli php-gd php-mcrypt php-mysql php-pear php-xml bzip2<\/pre>\n
cd \/opt\/\nwget https:\/\/download.owncloud.org\/community\/owncloud-8.0.0.tar.bz2\ntar xfv owncloud-8.0.0.tar.bz2\nmv owncloud \/var\/www\/html<\/pre>\n
chown nginx:nginx -R \/var\/www\/html\/owncloud<\/pre>\n
sed -i s'\/user = apache\/user = nginx\/' \/etc\/php-fpm.d\/www.conf\nsed -i s'\/group = apache\/group = nginx\/' \/etc\/php-fpm.d\/www.conf<\/pre>\n
mkdir -p \/data\nchown nginx:nginx \/data<\/pre>\n
mysql -uroot -p\nMariaDB [(none)]> create database ownclouddb;\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON ownclouddb.* TO 'owncloud'@'localhost' IDENTIFIED BY 'your-password';\nMariaDB [(none)]> flush privileges;\nMariaDB [(none)]> quit<\/pre>\n
openssl req -new -x509 -days 365 -nodes -out \/etc\/nginx\/your-domain.com.crt -keyout \/etc\/nginx\/your-domain.com.key\n\nchmod 600 \/etc\/nginx\/your-domain.com.crt\nchmod 600 \/etc\/nginx\/your-domain.com.key<\/pre>\n
vi \/etc\/nginx\/sites-available\/your-domain.com.conf<\/pre>\n
server {\n listen 80;\n server_name your-domain.com;\n rewrite ^ https:\/\/$server_name$request_uri? permanent;\n}\n\nserver {\n listen 443 ssl;\n\t\tserver_name your-domain.com;\n\t\tssl_certificate \/etc\/nginx\/your-domain.com.crt;\n\t\tssl_certificate_key \/etc\/nginx\/your-domain.com.key;\n\t\troot \/var\/www\/html\/owncloud;\n access_log \/var\/log\/nginx\/your-domain.com_access.log;\n error_log \/var\/log\/nginx\/your-domain.com_error.log;\n index index.php;\n client_max_body_size 2000M;\n\n rewrite ^\/caldav(.*)$ \/remote.php\/caldav$1 redirect;\n rewrite ^\/carddav(.*)$ \/remote.php\/carddav$1 redirect;\n rewrite ^\/webdav(.*)$ \/remote.php\/webdav$1 redirect;\n\n error_page 403 \/core\/templates\/403.php;\n error_page 404 \/core\/templates\/404.php;\n\n location = \/robots.txt {\n allow all;\n log_not_found off;\n access_log off;\n }\n\n location ~ ^\/(?:\\.htaccess|data|config|db_structure\\.xml|README) {\n deny all;\n }\n\n location \/ {\n rewrite ^\/.well-known\/carddav \/remote.php\/carddav\/ redirect;\n rewrite ^\/.well-known\/caldav \/remote.php\/caldav\/ redirect;\n rewrite ^(\/core\/doc\/[^\\\/]+\/)$ $1\/index.html;\n try_files $uri $uri\/ index.php;\n }\n\n location ~ \\.php(?:$|\/) {\n fastcgi_split_path_info ^(.+\\.php)(\/.+)$;\n include fastcgi_params;\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n fastcgi_param PATH_INFO $fastcgi_path_info;\n fastcgi_param HTTPS on;\n fastcgi_pass unix:\/var\/run\/php5-fpm.sock;\n }\n\n error_page 500 502 503 504 \/50x.html;\n location = \/50x.html {\n root html;\n }\n}<\/pre>\n
#cat \/etc\/php-fpm.d\/www.conf | grep session.save_path\nphp_value[session.save_path] = \/var\/lib\/php\/session<\/pre>\n
chown root:nginx \/var\/lib\/php\/session\nchown -R nginx:nginx \/var\/lib\/php\/session\/*<\/pre>\n
mkdir -p \/etc\/nginx\/sites-available\nmkdir -p \/etc\/nginx\/sites-enabled\nln -s \/etc\/nginx\/sites-available\/your-domain.com.conf \/etc\/nginx\/sites-enabled\/your-domain.com.conf<\/pre>\n
include \/etc\/nginx\/sites-enabled\/*.conf;<\/pre>\n
vi \/etc\/nginx\/nginx.conf<\/pre>\n
include \/etc\/nginx\/sites-enabled\/*.conf;<\/pre>\n
vi \/etc\/php-fpm.d\/www.conf<\/pre>\n
;listen = 127.0.0.1:9000\nlisten = \/var\/run\/php5-fpm.sock<\/pre>\n
systemctl restart php-fpm\nsystemctl restart nginx<\/pre>\n
systemctl enable php-fpm\nsystemctl enable nginx<\/pre>\n