Owncloud, installation and setup

来源:互联网 发布:腾讯程序员平均年龄 编辑:程序博客网 时间:2024/05/23 00:09

This HowTo has been updated to work with version 5 of Owncloud. It does not work with version 4.


Contents

 [hide]
  • 1 Installation of required packages
  • 2 Setting up mySQL database and users permissions using Webmin
  • 3 Setting up OwnCloud configuration files
  • 4 Running OwnCloud installation
  • 5 Some other suggestions

Installation of required packages

Download and un-tar version 5 of OwnCloud from here


Now open the Synaptic package manager and install the following packages.

apache-baseapache-mod_phpmysql-clientmysql-commonphp-fileinfophp-zipphp-mysqlphp-zipphp-curlphp-iconvphp-pdophp-intlphp-gdphp-xmlwebmin


and any associated decencies with the above packages.

Now we need to make sure that the needed services are running. Open a console/terminal window. As the root user enter the following command(s)

enter service httpd start

you should see something like

[root@laptop dwmoar]# service httpd start
Starting httpd: [ OK ]
[root@laptop dwmoar]# 


enter service mysqld start

you should see something like

[root@laptop dwmoar]# service mysqld start
Starting MySQL: ., [ OK ]
[root@laptop dwmoar]#


enter /etc/webmin/start

you should see something like

[root@laptop dwmoar]# /etc/webmin/start
Starting Webmin server in /usr/libexec/webmin
Pre-loaded WebminCore
[root@laptop dwmoar]#


Now we have the basics installed, and can move to setting the mySQL database, users and permissions.


Setting up mySQL database and users permissions using Webmin

See additional notes*

Open your favorite web browser and go to http://localhost:10000

This is the Webmin mini server page.

It should ask for a username and password. the default username is "root" and the password is your root password.

Webmin-login.png

In the left window pane click on Servers and than click on MySQL Database Server

Webmin-main-screen.png

Webmin-mysql-server.png


Under the MySQL Database section click on "Create a new database" Under "New Database Options" enter your database name. In my example I called mine owncloud201

Webmin-create-database.png

Leave everything else blank. Press the "Create" button. You will be returned to the MySQL Database Server Page.

Under the "Global Options" select "database permissions" Now click on "Create new database permissions"

enter the following information.

Under Databases - click the circle in front of Selected and than click on the drop-down list and select the name of your database. In my example my database is called "owncloud201"

Under the Username - click the circle in front of the text box and enter a username for your database. NOTE: this is NOT your username... In my example I entered "owncloud"

Under Hosts - click the circle in front of the text box and enter "localhost"

Under Permissions - select all permissions.

When finished click on "Create"

Permissions-creation.png

You should be returned to the Database Creation Page. You should now see your database name listed.

Database permissions.png

Now click "Return to database list" You will be returned to the MySQL Database Server Main page.

Under "Global Options" click on "User Permissions"

Click on "Create new user"

Creating-users.png

We now need to create two new users. The first one for access to the database and the second the owncloud user. Neither of these names can be the same.

Under username - click the dot in front of the text box and enter the username of the database. This is the same name a we setup in the previous step. In my example it was "owncloud"

Under Password - enter the password that you want to use.

Under Hosts - click the dot in front of the text box and enter "localhost"

Under Permissions - select all

Press "Create"

Dbowner-setup.png

You will be returned to the User Permissions Page

Now we need to add one more user. Repeat the above steps only this time we need to create a username. This name can not be the same as the database owners name. It is also best not to use your own system username. In my example I entered "mycloud" for the username

Fill out the Username, Password, Hosts information. DO NOT select any Permissions. This user does not require then. When you are finished press "Create". Once again you will be returned to the User Permissions page.

You should notice both users have been added. Also note that all your passwords are now encrypted.

That's it...... Now press "Return to database list"

Now we want to restart the mysql server for our additions to be recognized.

Click on Stop MySQL Server

You should see a page like this

Start-server.png

Now click on Start MySQL server

If everything goes right you should see the main MySQL server page. Now click Logout in the left hand pane.


Setting up OwnCloud configuration files

Now we want to setup the configuration files and change permissions to some of the OwnCloud folders

Open a terminal window (console)

The first thing we want to do, as root, is go to the webserver directory "/var/www/html"

Type in cd /var/www/html <press enter>

You should see something like this

[root@laptop dwmoar]# cd /var/www/html
[[root@laptop html]#

Next we want to change the owncloud folder UID/GID to that of the webserver. Enter the following command chown -R apache:apache owncloud <press enter>

You should see something like this

[[root@laptop html]# chown -R apache:apache owncloud
[[root@laptop html]#

This command has changed the UID/GID of the folder and everything within the owncloud folder to "apache"

Now type in cd owncloud.

In the owncloud directory we need to change the permissions to the config folder to have all permissions.

Enter chmod 777 config <press enter>

Next we want to move the data directory out of the web root directory. This helps keep your data secure. To accomplish this we will use the following command

mv data /var/www <press return>

and we now need to change permissions of the data directory

enter chmod 775 /var/www/data <press enter>

We have just one more step left to do now.

We need to change the config.php file to set the path to the data directory.

Enter cd /var/www/html/owncloud/config <press enter>

now we are in the config folder. We need to edit the config.php file. Using your favorite text editor open the config.php file. I will be using nano to do this

at the prompt type in nano config.php <press enter>

you should now see the file. In my example it looks like this

[root@laptop config]# nano config.php

<?php$CONFIG = array("installed" => true,"dbtype" => 'mysql',"dbname" => 'owncloud201',"dbuser" => 'mycloud',"dbpassword" => 'Ihaveallthepower',"dbhost" => 'localhost',"dbtableprefix" => ,"forcessl" => false,"enablebackup" => false,"datadirectory" => '/var/www/data',"version" => '2.0.1',"installedat" => '1324340526.4031',"lastupdatedat" => '1324340689.9227',);?>

We are going to change the following, only change the information that is between the single quote marks.

dbtype = mysqldbname = the database name you chose. My example was "owncloud201"dbuser = the user name. My example was "mycloud"dbpassword = the password for you database user above. This will be in plain text for now. Once the owncloud installation page is ran it will encrypt it.dbhost = localhostdatadirectory = the path to the data directory "/var/www/data"

Once you have made the changes save the file by pressing ctrl and x. You will be prompted to Save modified buffer. Just press "y" and than press enter. You can close the console/terminal window.

We are now at the final step to setting up owncloud.


Running OwnCloud installation

Now point your web browser to localhost/owncloud

You should see something like this

Owncloud-install.png

Enter the username and password that we added in the mysql section. In my example it was "mycloud"

Owncloud-install1.png

now press the advanced option. You should see something like this

Owncloud-install2.png

Owncloud-install3.png

Now fill in the database & users information. In my example the dbuser was "owncloud", my password, the database name "owncloud201" and the Host "localhost" When you have entered this information you should now be logged into your owncloud.


Owncloud-login-screen.png

Owncloud-login-screen1.png


Some other suggestions

Increasing the file upload size

To increase the file upload size in owncloud you need to change a couple of php variables.There is several ways to make this change.

1. If you have access to the php.ini file you can edit it directly. The php.ini file is located at /etc/php.ini. Any changes to this file need to be done as the root user. Using your favorite text editor and open the php.ini file. You want to search for the following variables

 php_value post_max_size php_value upload_max_filesize

These are set by default a 2M (2MB) just increase the number to whatever size you would like. For example if you want your uploaded file to be 50MB in size that you need your variables to look like this

php_value post_max_size 50Mphp_value upload_max_filesize 50M

In order for these new values become effective you must restart your web server. In a console/terminal window as root enter the following command

service httpd restart

You should see something like this

root@laptop dwmoar]# service httpd restart
Shutting down httpd: [ OK ]
Starting httpd: [ OK ]
[root@laptop dwmoar]#

2. You can also add a .htaccess file to the owncloud root directory. The advantaged to doing this is

 a. If you happen to be on a shared hosted system. You can change the operation of php without effecting the whole system.     Most shared hosts will not makes these changes, since it will effect all the users on the system. b. You don't have to mess with your php.ini file. Less chance of messing up you php.ini file.

Adding a .htaccess file is relatively a simple process.

Open your favorite text editor as root and create a .htaccess file with the following information. In my example I will use the nano editor.

[root@laptop dwmoar]# nano .htaccess Note the dot in front of htaccess

Than add the following, each on a line by themselves

php_value post_max_size 50Mphp_value upload_max_filesize 50M

I have set my two variables to 50 MB in size

I than press ctrl & x

Nano will ask me "Save modified buffer. I type in Y (yes) and press enter
Then nano will ask "File Name to Write and I enter /var/www/html/owncloud/.htaccess and press enter. The file .htaccess has now been saved in my owncloud directory. I can verify this by doing a listing of my owncloud directory

at the command prompt type this command

ls -la /var/www/html/owncloud

You should see something similar to this

[root@laptop owncloud]# ls -la /var/www/html/owncloud
total 120
drwxr-xr-x 13 apache apache 4096 Dec 21 19:10 ./
drwxr-xr-x 7 root root 4096 Dec 19 15:42 ../
drwxrwxr-x 10 apache apache 4096 Dec 19 15:40 3rdparty/
drwxrwxr-x 15 apache apache 4096 Dec 19 15:40 apps/
-rw-rw-r-- 1 apache apache 246 Nov 21 10:32 AUTHORS
drwxrwxrwx 2 apache apache 4096 Dec 21 19:16 config/
-rw-rw-r-- 1 apache apache 34520 Nov 21 10:32 COPYING-AGPL
-rw-rw-r-- 1 apache apache 567 Nov 21 10:32 COPYING-README
drwxrwxr-x 9 apache apache 4096 Dec 19 15:40 core/
drwxr-xr-x 2 apache apache 4096 Dec 21 19:10 data/
-rw-rw-r-- 1 apache apache 8026 Nov 21 10:32 db_structure.xml
drwxrwxr-x 8 apache apache 4096 Dec 19 15:40 files/
-rw-r--r-- 1 apache apache 315 Dec 19 16:22 .htaccess
-rw-rw-r-- 1 apache apache 3158 Nov 21 10:33 index.php
drwxrwxr-x 27 apache apache 4096 Dec 19 15:40 l10n/
drwxrwxr-x 10 apache apache 4096 Dec 19 15:40 lib/
drwxrwxr-x 2 apache apache 4096 Dec 19 15:40 ocs/
-rw-rw-r-- 1 apache apache 502 Nov 21 10:32 README
drwxrwxr-x 7 apache apache 4096 Dec 19 15:40 search/
drwxrwxr-x 9 apache apache 4096 Dec 19 15:40 settings/
-rw-rw-r-- 1 apache apache 1176 Nov 21 10:32 status.php
lrwxrwxrwx 1 apache apache 42 Dec 19 16:22 .well-known -> /var/www/html/owncloud/apps/user_webfinger/


NOTE: the .htaccess file

For this to take effect the webserver must be restarted. As the root user enter the command

service httpd restart

you should see the following

root@laptop dwmoar]# service httpd restart
Shutting down httpd: [ OK ]
Starting httpd: [ OK ]
[root@laptop dwmoar]#


If you are having problems installing owncloud or just have questions, please post them on the PCLinuxOS forum


*additional notes: The OwnCloud database can also be setup in several different methods. Such as using the GUI program phpMyAdmin (can be found in the package manager) or from the command line. I used Webmin as this is the program I am most familiar with and I use to administrate all of my web servers with. Be aware that setting up the database using the command line (CLI) is best left to the more knowledgeable user familiar with the CLI and MySQL operational commands.


原文地址:点击打开链接

原创粉丝点击