1. 程式人生 > >基於CentOS 7.2個人網盤的實現

基於CentOS 7.2個人網盤的實現

x86 nis nvi abort restart lease network wget risa

首先使用YUM安裝依賴環境:

[root@sishen ~]#yum install python python-setuptools python-imaging python-ldap python-memcached MySQL-python mariadb mariadb-server

啟動MySQL並設置其開機啟動:

[root@sishen ~]# systemctl start mariadb

[root@sishen ~]# systemctl enable mariadb

MySQL安全初始化

[root@sishen ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we‘ll need the current
password for the root user. If you‘ve just installed MariaDB, and
you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

You already have a root password set, so you can safely answer ‘n‘.

Change the root password? [Y/n] y #註意這裏我是第二次初始化了,所以跟初次安裝時的提示不一樣,如果是初次安裝,直接回車即可,這一步除了設置mysql的root密碼之外,其他選項可以直接回車,也可以依據個人需要進行設置。


New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
... Success!

Normally, root should only be allowed to connect from ‘localhost‘. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
... Success!

By default, MariaDB comes with a database named ‘test‘ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
... Success!

Cleaning up...

All done! If you‘ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

下載seafile

[root@sishen ~]# wget https://mc.qcloudimg.com/static/archive/3d8addbe52be88df4f6139ec7e35b453/seafile-server_5.1.4_x86-64.tar.gz

創建安裝目錄並解壓

[root@sishen ~]# mkdir -p /opt/seafile/installed

[root@sishen ~]# mv seafile-server_5.1.4_x86-64.tar.gz /opt/seafile/installed/

[root@sishen installed]# tar -zxf seafile-server_5.1.4_x86-64.tar.gz -C /opt/seafile/

[root@sishen installed]# cd ../seafile-server-5.1.4/
[root@sishen seafile-server-5.1.4]# ls
check_init_admin.py seaf-fuse.sh seahub setup-seafile.sh
reset-admin.sh seaf-gc.sh seahub.sh upgrade
runtime seafile setup-seafile-mysql.py
seaf-fsck.sh seafile.sh setup-seafile-mysql.sh

[root@sishen seafile-server-5.1.4]# ./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.

-----------------------------------------------------------------
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 ] 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 ] 192.168.75.130 #輸入主機的ip地址

Where do you want to put your seafile data?
Please use a volume with enough free space
[ default "/opt/seafile/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 #這裏選擇1

What is the host of mysql server?
[ default "localhost" ] #默認無需修改,直接回車

What is the port of mysql server?
[ default "3306" ] #默認無需修改,直接回車

What is the password of the mysql root user?
[ root password ] #這裏輸入上面mysql安全初始化時設置的root for mysql的密碼

verifying password of user root ... done

Enter the name for mysql user of seafile. It would be created if not exists.
[ default "root" ] #這裏直接回車

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: seafile
server ip/domain: 192.168.75.130

seafile data dir: /opt/seafile/seafile-data
fileserver port: 8082

database: create new
ccnet database: ccnet-db
seafile database: seafile-db
seahub database: seahub-db
database user: root


---------------------------------
Press ENTER to continue, or Ctrl-C to abort #這裏直接回車
---------------------------------

Generating ccnet configuration ...

done
Successly create configuration dir /opt/seafile/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.


啟動seafile

[root@sishen seafile-server-5.1.4]# ./seafile.sh start

[11/30/17 02:24:31] ../common/session.c(132): using config file /opt/seafile/conf/ccnet.conf
Starting seafile server, please wait ...
Seafile server started

Done.
[root@sishen seafile-server-5.1.4]# ./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 ] [email protected]

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.


測試登錄

技術分享圖片

技術分享圖片

基於CentOS 7.2個人網盤的實現