重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

linux安装owncloud

为了保证一个纯净的环境,我重新安装了一台centos系统

创新互联服务项目包括龙沙网站建设、龙沙网站制作、龙沙网页制作以及龙沙网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,龙沙网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到龙沙省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

[root@localhost httpd-2.2.23]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.3 (Final)
Release: 6.3
Codename: Final

在安装玩系统之后,首先需要搭建yum源,centos的网络yum源是非常简单的,甚至不需要你修改任何配置,只要安装一个小软件,rpm -ivh epel-release-6-5.noarch.rpm

然后yum就可以使用了

第一部分 apache的安装

由于在编译apache的时候,需要用到一些插件,所以我们需要提前安装

yum install gcc gcc-c++ ncursers-devel zlib2-zip -y

apache的编译安装很简单,但是我们需要安装一些包便于apache功能的扩展

1、apr-1.4.6.tar.gz 的安装

[root@localhost lamp]# tar xf apr-1.4.6.tar.gz -C /usr/src/lamp/

[root@localhost apr-1.4.6]# pwd
/usr/src/lamp/apr-1.4.6

[root@localhost apr-1.4.6]# ./configure --enable-threads --disable-ipv6 --with-devrandowm=/dev/random && make && make install

2、libiconv-1.13.tar.gz的安装

[root@localhost libiconv-1.13]# ./configure --enable-static && make && make install

3、apr-iconv-1.2.1.tar.gz的安装

[root@localhost lamp]# tar xf apr-iconv-1.2.1.tar.gz -C /usr/src/lamp/

[root@localhost apr-iconv-1.2.1]# ./configure --with-apr=/usr/local/apr/bin/apr-1-config

[root@localhost lamp]# make && make install

[root@localhost apr-iconv-1.2.1]# ln -s /usr/src/lamp/apr-iconv-1.2.1/lib/libapriconv-1.la /usr/src/lamp/apr-iconv-12.1/lib/libapriconv.la

4、安装openssl nss-devel

[root@localhost lamp]# yum install openssl* nss-devel -y

5、安装apr-util-1.4.1.tar.gz

[root@localhost lamp]# tar xf apr-util-1.4.1.tar.gz -C /us
r/src/lamp/

[root@localhost apr-util-1.4.1]# ./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-iconv=./apr-iconv --with-openssl=/usr --with-nss=/usr --with-mysql=/usr/local/mysql --with-iconv=/usr/local && make && make install

6、安装两个rpm包

libzip-0.9-3.1.el6.i686.rpm
libzip-devel-0.9-3.1.el6.i686.rpm

[root@localhost lamp]# rpm -ivh libzip-0.9-3.1.el6.i686.rpm
warning: libzip-0.9-3.1.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:libzip ########################################### [100%]
[root@localhost lamp]# rpm -ivh libzip-devel-0.9-3.1.el6.i686.rpm
warning: libzip-devel-0.9-3.1.el6.i686.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing... ########################################### [100%]
1:libzip-devel ########################################### [100%]

7、安装pcre-7.9.tar.gz

[root@localhost lamp]# tar xf pcre-7.9.tar.gz -C /usr/src/lamp/

[root@localhost pcre-7.9]# ./configure --enable-utf8 --enable-rebuild-chartables --enable-newline-is-any --enable-pcregrep-libz --enable-pcregrep-libbz2

make && make install

8、安装httpd--2.2.23.tar.gz

[root@localhost softs]# tar xf httpd--2.2.23.tar.gz -C /usr/src/

[root@localhost softs]# cd /usr/src/httpd-2.2.23/

[root@localhost httpd-2.2.23]#./configure --enable-modules=all --enable-mods-shared=all --enable-cache --enable-disk-cache --enable-dumpio --enable-echo --enable-example --enable-logio --enable-mime-magic --enable-expires --enable-headers --enable-unique-id --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-proxy-ajp --enable-proxy-connect --enable-ssl --enable-static-ab --enable-http --enable-info --enable-cgi --enable-vhost-alias --enable-so --enable-rewrite --with-apr=/usr/local/apr-httpd/bin/apr-1-config --with-apr-util=/usr/local/apr-httpd/bin/apu-1-config --with-pcre=/usr/local --with-ssl=/usr --with-mpm=prefork

9、修改apache配置文件

[root@localhost ~]# vi /usr/local/apache2/conf/httpd.conf 指定DocumentRoot和允许访

将第195行的目录路也为 /var/www

[root@localhost ~]# mkdir /var/www /var/log/httpd

[root@localhost ~]# chown -R daemon.daemon /var/www /var/log/httpd

[root@localhost ~]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/apache

[root@localhost ~]# /etc/init.d/apache start

[root@localhost htdocs]# mv /usr/local/apache2/htdocs/index.html /var/www/ ------将apache默认路径下的index.html移动到指定的DocumentRoot下面

浏览器访问http://127.0.0.1/

It works!
10、开启虚拟主机
[root@localhost conf]# vi httpd.conf
将这一行前面的#去掉
Include conf/extra/httpd-vhosts.conf
[root@localhost extra]# cd /usr/local/apache2/conf/extra/
[root@localhost extra]# vi httpd-vhosts.conf ##增加一台虚拟主机

ServerAdmin owncloud@localhost
DocumentRoot "/var/www/owncloud"
ServerName test.owncloud.com
ErrorLog "/var/log/httpd/owncloud.error.log"
CustomLog "/var/log/httpd/owncloud-access_log" common
重启apache服务
apache的安装到此完成
####################################################################
第二部分mysql的安装
1、新建用户及相关目录,并修改相关的属主和属组。

useradd mysql

mkdir /var/log/mysqld

mkdir /var/run/mysqld

mkdir /database

chown mysql.mysql -R /var/log/mysqld /var/run/mysqld /database


2、下载软件并解压编译安装

下载地址http://yun.baidu.com/share/link?shareid=933310467&uk=2819702030&third=0

[root@localhost softs]# tar xf mysql-5.6.10.tar.gz -C /usr/src/
[root@localhost softs]# cd /usr/src/mysql-5.6.10/

3、这里需要cmake安装

[root@localhost mysql-5.6.10]# cmake -DCMAKE_ISTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DMYSQL_DATADIR=/datadir -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql5.sock -DWITH_DEBUG=ON -DEXTRA_CHARSETS=ALL -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DSYSCONFDIR=/usr/local/mysql/etc -DWITH_READLINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1

4、通过对比可以看出,在cmake前后的差异还是蛮大的,接下来make

[root@localhost mysql-5.6.10]# make

5、make这一步比较慢,需要多等一下,下一步就是make install

make install 完成后,接下来就是对mysql进行配置

6、对mysql的初始化操作

[root@localhost ~]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/database --user=mysql

2013-10-28 04:13:57 13176 [Note] InnoDB: FTS optimize thread exiting.
2013-10-28 04:13:57 13176 [Note] InnoDB: Starting shutdown...
2013-10-28 04:13:58 13176 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2013-10-28 04:13:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-28 04:13:58 7f78a8ba0720 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2013-10-28 04:13:58 7f78a8ba0720 InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!
2013-10-28 04:13:58 13199 [Note] InnoDB: The InnoDB memory heap is disabled
…………………………
2013-10-28 04:14:00 13199 [Note] InnoDB: Starting shutdown...
2013-10-28 04:14:01 13199 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

两个OK表示成功

7、修改mysql的几个配置文件

[root@localhost ~]# cd /usr/local/mysql/

[root@localhost etc]# chown -R mysql.mysql /usr/local/mysql
[root@localhost mysql]# mkdir etc
[root@localhost mysql]# cd etc/
[root@localhost etc]# vi my.cnf -----------主配置文件的修改

[root@localhost etc]# cat my.cnf | grep -v ^# | grep -v ^$
[mysqld]
log_bin=myql-bin
log-bin-index=mysql-bin.index
log-error=/var/log/mysqld/error.log
general_log=1
general_log_file=/var/log/mysqld/mysql.log
basedir = /usr/local/mysql
datadir = /database
port = 3306
socket = /var/run/mysqld/mysql5.socket
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[root@localhost etc]# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql5

开始尝试启动mysql

[root@localhost mysqld]# /etc/init.d/mysql5 restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL.. [ OK ]

mysql 到此安装完成

##############################################################

第三部分 php的安装

1、下载软件并安装

yum install libxml2 libxml2-devel -ylibcurl libcurl-developenssl openssl-devel

[root@localhost php-5.3.27]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --disable-ipv6 --with-libxml-dir=/usr --with-openssl=/usr --with-zlib=/usr --with-bz2=/usr --with-curl=/usr --enable-ftp --with-mysql=/usr/local/mysql --with-mysql-sock=/var/run/mysqld/mysql5.socket --with-mysqli=/usr/local/mysql/bin/mysql_config

这里报了一个错误

checking for X509_free in -lcrypto... yes
checking for pkg-config... /usr/bin/pkg-config
configure: error: Cannot find OpenSSL\'s libraries

解决方法:
安装opensslyum install openssl openssl-devel (如果没有安装的话)

建立软链接

ln -s /usr/lib64/libssl.so /usr/lib/

2、make && make install

3、测试php是否安装成功

[root@localhost www]# vi index.php
phpinfo();
?>

页面访问http://127.0.0.1/index.php

##############################################

第四部分 owncloud的安装

1、下载并解压

[root@localhost softs]# tar xf owncloud-5.0.0.tar.bz2 -C /var/www/

[root@localhost conf]# chown -R daemon.daemon /var/www/

2、接下来页面访问http://192.168.254.153/owncloud/index.php

可以看到返回的错误就是php少了三个模块功能的扩展(zip,mb,GD)

3、所以接下来就要给php打三个补丁

首先我做个gd的扩展

[root@localhost gd]# pwd
/usr/src/php-5.3.27/ext/gd

[root@localhost gd]# yum install gd-devel --------GD的开发扩展包

[root@localhost gd]# ls
config.m4 CREDITS gdcache.c gd_ctx.c libgd tests
config.w32 gd.c gdcache.h gd.dsp php_gd.h

[root@localhost gd]# /usr/local/bin/phpize ##生成gd模块
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626

通过对比,发现多了可以编译的参数,所以接下来进行编译安装

[root@localhost gd]# ./configure && make && make install 最后返回了下面两行

Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
Installing header files: /usr/local/include/php/

接下来修改php配置文件

[root@localhost gd]# cd modules/
[root@localhost modules]# ls
gd.so

生成一个gd.so的库文件,需要加到php.ini的扩展中,然后需要在/usr/local/lib/php.ini文件中加下面两行

vi /usr/loca/lib/php.ini

extension_dir="/usr/local/lib/php/extensions/no-debug-non-zts-20090626/"
extension=gd.so

重启apache服务即可

[root@localhost ~]# /etc/init.d/apache restart

现在gd模块安装成功了,接下来只是简单介绍一下另外两个模块的扩展,首先是zip模块

[root@localhost zip]# cd /usr/src/php-5.3.27/ext/zip

[root@localhost zip]# /usr/local/bin/phpize

[root@localhost zip]# ./configure && make

[root@localhost zip]# make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
[root@localhost zip]# ls modules/
zip.so

[root@localhost zip]# vi /usr/local/lib/php.ini

增加一行extension=zip.so

最后是mb模块的扩展

[root@localhost ~]# cd /usr/src/php-5.3.27/ext/mbstring/

[root@localhost mbstring]# /usr/local/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626

[root@localhost mbstring]# ./configure && make && make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
Installing header files: /usr/local/include/php/

[root@localhost mbstring]# ls modules/
mbstring.so

[root@localhost mbstring]# vi /usr/local/lib/php.ini

在增加一行extension=mbstring.so

这里总共增加了四行扩展

重启apache服务,然后刷新页面

[root@localhost mbstring]# service apache restart

4、从图中也可以看出,owncloud报了新的错误

Security Warning

Your data directory and files are probably accessible from the internet because the .htaccess file does not work.
For information how to properly configure your server, please see the documentation.

解决这个问题,只需要在我建立的虚拟主机中增加


ServerAdmin owncloud@localhost
DocumentRoot "/var/www/owncloud"

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ServerName test.owncloud.com
ErrorLog "/var/log/httpd/owncloud.error.log"
CustomLog "/var/log/httpd/owncloud-access_log" common

5、建立管理用户,连接mysql,指定数据目录

在mysql数据库中新建授权用户

然后建立管理用户,并链接数据库。

然后重启apache服务

5、建立管理员账户,然后登陆

注意:这里强烈建议使用firefox访问,我之前使用360访问,发现有问题,而且页面格式排版都有问题,但是日志不报错。

至此,owncloud结束,如果本文中有任何错误请大家指正!


网站标题:linux安装owncloud
URL地址:http://cqcxhl.com/article/cjsggo.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP