1、环境
centos6.5
mysql5.6
python2.7
Imaging库
mysqldb库
2、环境初始化
2.1、升级python版本到2.7(比较容易安装,这里不再阐述)
2.2、升级pip(比较容易安装,这里不再阐述)
2.3、安装依赖包
[root@bgs-4p100-linan software]# tar -xf Imaging-1.1.7.tar.gz -C /opt/
[root@bgs-4p100-linan opt]# cd /opt/Imaging-1.1.7/
[root@bgs-4p100-linan Imaging-1.1.7]# vim setup.py
修改如下几项:
TCL_ROOT = "/usr/lib64/"
JPEG_ROOT = "/usr/lib64/"
ZLIB_ROOT = "/usr/lib64/"
TIFF_ROOT = "/usr/lib64/"
FREETYPE_ROOT = "/usr/lib64/"
LCMS_ROOT = "/usr/lib64/"
#检查
[root@bgs-4p100-linan Imaging-1.1.7]# python setup.py build_ext -i
#上面检查不报错执行下面安装
[root@bgs-4p100-linan Imaging-1.1.7]# python setup.py install
[root@bgs-4p100-linan Imaging-1.1.7]# python
Python 2.7.8 (default, Feb 26 2018, 04:24:02)
[GCC 5.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image;
>>>
安装MySQL-pytho依赖
[root@bgs-4p100-linan Imaging-1.1.7]# yum install mysql-devel
[root@bgs-4p100-linan Imaging-1.1.7]# cd /opt/
[root@bgs-4p100-linan opt]# wget http://mirror.baifendian.com/python/MySQL-python-1.2.3.tar.gz
[root@bgs-4p100-linan opt]# tar -zxf MySQL-python-1.2.3.tar.gz -C /opt/
[root@bgs-4p100-linan opt]# cd /opt/MySQL-python-1.2.3
[root@bgs-4p100-linan MySQL-python-1.2.3]# python setup.py build
[root@bgs-4p100-linan MySQL-python-1.2.3]# python setup.py install
这次安装中出现了一个报错,错误截图:
解决方案:
2.4.创建用户
[root@bgs-4p100-linan opt]# groupadd sys
[root@bgs-4p100-linan opt]# useradd -g sys -d /opt/sys sys
[root@bgs-4p100-linan opt]# mkdir /opt/conf
[root@bgs-4p100-linan opt]# chown sys.sys /opt/conf -R
[root@bgs-4p100-linan ~]# mkdir /opt/ccnet
[root@bgs-4p100-linan ~]# chown sys.sys /opt/ccnet -R
[root@bgs-4p100-linan ~]# chown sys.sys /opt/seafile -R
[root@bgs-4p100-linan ~]# mkdir /opt/seahub
[root@bgs-4p100-linan ~]# chown sys.sys /opt/seahub -R
3.安装部署
[root@bgs-4p100-linan opt]# wget http://mirror.baifendian.com/seafile/seafile-server_6.0.7_x86-64.tar.gz
[root@bgs-4p100-linan opt]# tar -zxf seafile-server_6.0.7_x86-64.tar.gz -C /opt
[root@bgs-4p100-linan ~]# cd /opt/sys/
[root@bgs-4p100-linan sys]# mv /opt/seafile-server-6.0.7 .
[root@bgs-4p100-linan sys]# ln -s seafile-server-6.0.7 seafile
[root@bgs-4p100-linan sys]# chown sys.sys seafile -R
[root@bgs-4p100-linan sys]# su - sys
[sys@bgs-4p100-linan ~]$ cd /opt/sys/seafile
[sys@bgs-4p100-linan seafile]$ ./setup-seafile-mysql.sh
Checking python on this machine ...
Checking python module: setuptools ... Done.
Checking python module: python-imaging ... Done.
Checking python module: python-mysqldb ... Done.
/usr/local/lib/python2.7/site-packages/setuptools-1.4.2-py2.7.egg/pkg_resources.py:979: UserWarning: /opt/sys/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable). -----------------------------------------------------------------
This script will guide you to setup your seafile server using MySQL.
Make sure you have read seafile server manual at
https://github.com/haiwen/seafile/wiki
Press ENTER to continue -----------------------------------------------------------------
What is the name of the server? It will be displayed on the client.
3 - 15 letters or digits
[ server name ] udptest_seafile
What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 172.24.4.100
Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/opt/sys/seafile-data" ]
Which port do you want to use for the seafile fileserver?
[ default "8082" ]
------------------------------------------------------- Please choose a way to initialize seafile databases: -------------------------------------------------------
[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
[ 1 or 2 ] 1
What is the host of mysql server?
[ default "localhost" ] 172.24.4.100
From which hosts could the mysql account be used?
[ default "%" ]
What is the port of mysql server?
[ default "3306" ]
What is the password of the mysql root user?
[ root password ] **** #root用户的mysql密码
verifying password of user root ... done
Enter the name for mysql user of seafile. It would be created if not exists.
[ default "seafile" ]
Enter the password for mysql user "seafile":
[ password for seafile ] **** #输入密码
verifying password of user seafile ... done
Enter the database name for ccnet-server:
[ default "ccnet-db" ]
Enter the database name for seafile-server:
[ default "seafile-db" ]
Enter the database name for seahub:
[ default "seahub-db" ]
--------------------------------- This is your configuration ---------------------------------
server name: udptest_seafile
server ip/domain: 172.24.4.100
seafile data dir: /opt/sys/seafile-data
fileserver port: 8082
database: create new
ccnet database: ccnet-db
seafile database: seafile-db
seahub database: seahub-db
database user: seafile
--------------------------------- Press ENTER to continue, or Ctrl-C to abort ---------------------------------
Generating ccnet configuration ...
done
Successly create configuration dir /opt/sys/ccnet.
Generating seafile configuration ...
Done.
done
Generating seahub configuration ...
---------------------------------------- Now creating seahub database tables ... ----------------------------------------
creating seafile-server-latest symbolic link ... done
----------------------------------------------------------------- Your seafile server configuration has been finished successfully. -----------------------------------------------------------------
run seafile server: ./seafile.sh { start | stop | restart }
run seahub server: ./seahub.sh { start <port> | stop | restart <port> }
----------------------------------------------------------------- If you are behind a firewall, remember to allow input/output of these tcp ports: -----------------------------------------------------------------
port of seafile fileserver: 8082
port of seahub: 8000
When problems occur, Refer to https://github.com/haiwen/seafile/wiki for information.
注意:执行过程中,最后一步总是报上述有一个数据库不能授权,但是mysql中又会将这些数据库给创建,我的解决方案是,到数据库中重新给授权,然后再执行的时候选择已经存在的数据库,下面这个选择2
[1] Create new ccnet/seafile/seahub databases
[2] Use existing ccnet/seafile/seahub databases
[ 1 or 2 ] 2
4.启动服务
[sys@bgs-4p100-linan seafile]$ ./seafile.sh start
[02/26/18 12:58:39] ../common/session.c(132): using config file /opt/sys/conf/ccnet.conf Starting seafile server, please wait ...
Seafile server started Done.
[sys@bgs-4p100-linan seafile]$ ./seahub.sh start
LC_ALL is not set in ENV, set to en_US.UTF-8 Starting seahub at port 8000 ... ----------------------------------------
It's the first time you start the seafile server. Now let's create the admin account ----------------------------------------
What is the email for the admin account?
[ admin email ] yinlong.wang@baifendian.com
What is the password for the admin account?
[ admin password ] Enter the password again:
[ admin password again ] ---------------------------------------- Successfully created seafile admin ----------------------------------------
Seahub is started Done.
成功如下图所示: