CentOS 7 seafile 설치

Binary 2019. 12. 1. 23:00

1. MariaDB 설치 및 서비스 자동실행

더보기

[genius@localhost ~]$ sudo yum install mariadb mariadb-server
[sudo] genius의 암호:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: data.aonenetworks.kr
 * extras: data.aonenetworks.kr
 * updates: data.aonenetworks.kr
...............
Total download size: 33 M
Installed size: 147 M
Is this ok [y/d/N]: y
Downloading packages:
...............
Complete!
[genius@localhost ~]$
[genius@localhost ~]$
[genius@localhost ~]$ sudo service mariadb start
Redirecting to /bin/systemctl start mariadb.service
[genius@localhost ~]$ sudo systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[genius@localhost ~]$

묻는 거 나오면 'y'

# yum install mariadb mariadb-server : mariadb 설치

# service mariadb start : mariadb 시작

# systemctl enable mariadb : mariadb 자동실행 등록

 

 

2. mariaDB 보안 설정

더보기

[genius@localhost bin]$ sudo /bin/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): //패스워드 설정을 안했으므로 그냥 Enter
OK, successfully used password, moving on...

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

Set root password? [Y/n] y
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] y
 ... 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] y
 ... 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] y
 - 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] y
 ... 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!
[genius@localhost bin]$

설명은 생략... 

 

3. MariaDB에서 seafile 관련 사항 설정

더보기

[genius@localhost ~]$ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
MariaDB [(none)]>
MariaDB [(none)]> create database `ccnet-db` character set = 'utf8mb4';
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create database `seafile-db` character set = 'utf8mb4';
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create database `seahub-db` character set = 'utf8mb4';
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]>
MariaDB [(none)]> create user 'seafile'@'localhost' identified by 'p@ssw0rd';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>
MariaDB [(none)]> GRANT ALL PRIVILEGES ON `ccnet-db`.* to `seafile`@localhost;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON `seafile-db`.* to `seafile`@localhost;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON `seahub-db`.* to `seafile`@localhost;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> Ctrl-C -- exit!
Aborted

# mysql -u root -p : Mariadb 접속, 아까 생성한 root 계정 패스워드 입력

# create database `ccnet-db` character set = 'utf8mb4';  : 데이터베이스 생성
# create database `seafile-db` character set = 'utf8mb4';  : 데이터베이스 생성
# create database `seahub-db` character set = 'utf8mb4';  : 데이터베이스 생성
# create user 'seafile'@'localhost' identified by '새로운 패스워드'; : mariadb의 seafile계정이 사용할 패스워드
# GRANT ALL PRIVILEGES ON `ccnet-db`.* to `seafile`@localhost; : 권한설정
# GRANT ALL PRIVILEGES ON `seafile-db`.* to `seafile`@localhost; : 권한설정
# GRANT ALL PRIVILEGES ON `seahub-db`.* to `seafile`@localhost; : 권한설정

 

4. 파이선 등 관련 라이브러리 설치

더보기

[genius@localhost ~]$ sudo yum -y install epel-release

[genius@localhost ~]$ sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

 

[genius@localhost ~]$ sudo yum -y install python-imaging MySQL-python python-distribute python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel python-requests

 

5. seafile Linux 계정 생성

더보기

[genius@localhost ~]$ sudo useradd -m -d /home/seafile seafile
[genius@localhost ~]$ sudo passwd seafile
seafile 사용자의 비밀 번호 변경 중
새  암호:
잘못된 암호: 암호에 어떤 형식으로 사용자 이름이 포함되어 있습니다
새  암호 재입력:
passwd: 모든 인증 토큰이 성공적으로 업데이트 되었습니다.

[genius@localhost ~]$ su - seafile
암호:
[seafile@localhost ~]$ cd ~
[seafile@localhost ~]$ pwd
/home/seafile

# useradd -m -d /home/seafile seafile : seafiel 계정 생성

# passwd seafile : seafile 계정 패스워드 설정

# su - seafile : seafile 계정으로 전환

# cd ~ : seafile의 홈디렉토리로 이동

# pwd : 현재 위치 확인

 

6. seafile 다운로드 및 압축 해제

더보기

[seafile@localhost ~]$ wget https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz 
[seafile@localhost ~]$ tar xvf seafile-server_7.0.5_x86-64.tar.gz

wget이 안되면 root로 전환해서 yum으로 wget을 설치하자.

#su

root 패스워드 입력

#yum install wget

 

7. seafile 설치

더보기

[seafile@localhost ~]$ cd seafile-server-7.0.5/
[seafile@localhost seafile-server-7.0.5]$ ./setup-seafile-mysql.sh
Checking python on this machine ...
  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 ] 사용할서버이름입력 

What is the ip or domain of the server?
For example: www.mycompany.com, 192.168.1.101
[ This server's ip or domain ] 리눅스ip입력

Where do you want to put your seafile data?
Please use a volume with enough free space

[ default "/home/seafile/seafile-data" ] 데이경로입력(또는엔터)

Which port do you want to use for the seafile fileserver?
[ default "8082" ] 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 ] 2

What is the host of mysql server?
[ default "localhost" ] 엔터

What is the port of mysql server?
[ default "3306" ] 엔터

Which mysql user to use for seafile?
[ mysql user for seafile ] 엔터

What is the password for mysql user "seafile"?
[ password for seafile ] mariadb의 seafile 패스워드(3번 참조)

verifying password of user seafile ...  done

Enter the existing database name for ccnet:
[ ccnet database ] ccnet-db

verifying user "seafile" access to database ccnet-db ...  done

Enter the existing database name for seafile:
[ seafile database ] seafile-db

verifying user "seafile" access to database seafile-db ...  done

Enter the existing database name for seahub:
[ seahub database ] seahub-db

verifying user "seafile" access to database seahub-db ...  done

---------------------------------
This is your configuration
---------------------------------

    server name:            ㅁㅁㅁㅁㅁ 
    server ip/domain:       192.168.xxx.xxx 

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

    database:               use existing
    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 /home/seafile/ccnet.
Generating seafile configuration ...

Checking python on this machine ...
  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 ]
The setup process is aborted

8. 방화벽 개방

더보기

[seafile@localhost seafile-server-7.0.5]$ exit
logout
[genius@localhost home]$ sudo firewall-cmd --permanent --add-port=8000/tcp
[sudo] genius의 암호:
success
[genius@localhost home]$ sudo firewall-cmd --permanent --add-port=8002/tcp
success
[genius@localhost home]$ sudo firewall-cmd --reload
success
[genius@localhost home]$ [genius@localhost home]$ sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp3s0
  sources:
  services: samba
  ports: 22/tcp 9091/tcp 8000/tcp 8002/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

# exit : seafile 계정을 관리자계정이 아니라서 firewall을 설정하기 위해 exit로 원래 관리자계정으로 돌아감

방화벽 설정 후 8000, 8002 포트 개방되었나 확인

 

9. ip변경 후 서비스 실행

더보기

[seafile@localhost ~]$ vi ~/conf/gunicorn.conf

bind = "192.168.x.x:8000"   //127.0.0.1:8000 -> 자신의ip:8000으로 변경

 


[seafile@localhost ~]$
[seafile@localhost ~]$ cd ./seafile-server-latest/
[seafile@localhost seafile-server-latest]$ ls
check_init_admin.py  reset-admin.sh  runtime  seaf-fsck.sh  seaf-fuse.sh  seaf-gc.sh  seafile  seafile.sh  seahub  seahub.sh  setup-seafile-mysql.py  setup-seafile-mysql.sh  setup-seafile.sh  sql  upgrade
[seafile@localhost seafile-server-latest]$ ./seafile.sh start

[12/01/19 22:41:41] ../common/session.c(132): using config file /home/seafile/conf/ccnet.conf
Starting seafile server, please wait ...
** Message: seafile-controller.c(718): No seafevents.

Seafile server started

Done.
[seafile@localhost seafile-server-latest]$ ./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 ] 메일주소

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.

[seafile@localhost seafile-server-latest]$

이제 윈도우에 브라우져에서

http://ip:8000 접속

 

10. 서비스 등록

더보기

[genius@localhost wd2t]$ cd /usr/lib/systemd/system

[genius@localhost system]$ sudo vi seafile.service

[Unit]

Description=Seafile

# add mysql.service or postgresql.service depending on your database to the line below

After=network.target mariadb.service

 

[Service] Type=forking

ExecStart=/var/lib/seafile/seafile-server-latest/seafile.sh start

ExecStop=/var/lib/seafile/seafile-server-latest/seafile.sh stop

User=seafile

Group=seafile

 

[Install]

WantedBy=multi-user.target

 


[genius@localhost system]$ sudo vi seahub.service

[Unit]

Description=Seafile hub

After=network.target seafile.service

 

[Service] Type=forking

# change start to start-fastcgi if you want to run fastcgi

ExecStart=/var/lib/seafile/seafile-server-latest/seahub.sh start

ExecStop=/var/lib/seafile/seafile-server-latest/seahub.sh stop

User=seafile Group=seafile

 

[Install]

WantedBy=multi-user.target

 

[genius@localhost system]$ sudo systemctl enable seafile
Created symlink from /etc/systemd/system/multi-user.target.wants/seafile.service to /usr/lib/systemd/system/seafile.service.
[genius@localhost system]$ sudo systemctl enable seahub
Created symlink from /etc/systemd/system/multi-user.target.wants/seahub.service to /usr/lib/systemd/system/seahub.service.

재부팅 후 확인한다.

블로그 이미지

나노지식

,