Tip: Authorization statement: This article authorizes the official Amazon Cloud Technology article to forward and rewrite the rights, including but not limited to Amazon Cloud Technology official channels such as Developer Centre, Zhihu, self-media platforms, third-party developer media, etc.
Article directory
Preface
In the past, our work of organizing files was very confusing. Project documents and materials were scattered in various places, and it often took a lot of effort to find information. Later, I wanted to develop an online knowledge management system to facilitate unified management. Last year I tried out the open source projectSeafile
and found that it is powerful and easy to use, which just meets our needs. We plan to build an online version of based on AWS Lightsail
. Recently I was browsing and found this evaluation activity of Amazon Cloud. I was very interested in it! This gave me another reason to participate in this review. Seafile
CSDN
提示:以下是本篇文章正文内容,下面案例可供参考
1. Introduction to Lightsail examples
- Detailed documentation:
https://aws.amazon.com/cn/lightsail/?nc2=h_ql_prod_fs_ls
Official case scenario:
- Launch a simple
Web
application
Use preconfigured development stacks such as LAMP
, Nginx
, MEAN
and Node.js
, to surf the Internet quickly and easily.
Create a custom website
- Build small business applications
Use preconfigured applications such as WordPress
, Magento
, Prestashop
and Joomla
, you can build and personalize your blog, e-commerce or personal website in just a few clicks.
- Start the test environment
Launch line-of-business software such as file storage and sharing, backup, financial and accounting software, and more.
To put it simply,Lightsail
is actually a super simple virtual server designed for novice friends. Unlike traditional VPS, it is not only very affordable, but also easy to configure. Supports Linux
and Windows
systems. We just select the system and resources and it's ready to go right out of the box.
What’s more important isLightsail
its outstanding simplified design ideas. Network settings such as public IP, bandwidth, and security groups can all be set with one click. Deploying common applications can also be selected with one click. For example, if you directly select the Linux
environment, you can run an environment for PHP
! And it is perfectly connected to the Amazon cloud ecosystem. This physical resource is safe and reliable, and performance monitoring is also in place. LAMP
2. Lightsail instance creation
First register an AWS account, you can receive 12 months of EC2 and 3 months for freeLightsail
, then go to the console ofLightsail
and click Create Instance enters the creation page
- Availability zone selection
Lightsail
provides multiple availability zones. We can choose the region closest to the business. Here I will choose Seoul
. You can choose the appropriate one by clicking to switch the availability zone.
You can switch easily at any time
Corresponding to , the platform our instance needs to run on is Linux
, so I chose Linux + Ubuntu22.04
as our deployment environment today
Note that we chose OS Only because we only need a clean operating system.
Regarding this key, if you want to customize it, you can create it directly, but you must download it to the local area as soon as possible after creation, because only one download is supported and AWS will not store our key.
After selecting your own configuration according to your needs, enter the unique identifier of the instance and click Create to start the instance.
This status means that the instance is running normally and the environment can be deployed!
3. Introduction to Seafile
Seafile
is an open source enterprise cloud disk that focuses on reliability and performance. Supports Windows
, Mac
, Linux
, iOS
, Android
platform. Supports file synchronization or direct mounting to local access. Seafile
The main focus is on file security. Writing a basic file synchronization tool is a simple matter, but it is important to ensure that it can work correctly in various extreme situations without losing data. Not an easy thing to do. Seafile focuses on the reliability of file synchronization. After 3 years of continuous improvement and use by hundreds of thousands of users, the synchronization algorithm has become very reliable. Seafile
's file history and database mirroring mechanism ensure that files can be easily restored to any historical state at any time.
It has the following characteristics:
-
Reliable file synchronization
Documents are organized into databases. Each library can optionally be synced to any device. Reliable and efficient file synchronization will improve your work efficiency.
-
Mount disk client
Access cloud files directly through the local S drive without occupying local storage. Provide computers with massive storage space of the server. Seamlessly integrated with the operating system, files can also be modified offline.
-
Teamwork
Files can be shared to groups. Permission management, version control, and event notification make collaboration smoother.
-
high performance
The Seafile server core is written in C. It's small and fast to run.
-
Wikis and knowledge management
Integrate the functions of Wiki and network disk, use Markdown format to edit Wiki documents in a WYSIWYG manner, provide search, tags, review and other knowledge management functions, and support external publishing of Wiki content.
-
Suitable for corporate environments
Can be integrated with AD/LDAP. AD group and user information can be synchronized.
4. Seafile environment construction
We first connect to the instance through the ssh
client, and then prepare to download , download address: < /span>Lightsail
Seafile
- https://www.seafile.com/download/
You can see thatLinux
the server supports Debian11
and Ubuntu22.04
, which means it can work normally in our system Run on
4.1 Download seafile
- Elevate privileges
sudo su
- Enter home directory
cd ~
- update source
apt-get update
- Download the installation package
wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_10.0.1_x86-64.tar.gz
tar -zxvf seafile-server_10.0.1_x86-64.tar.gz
cd seafile-server_10.0.1
After decompression, we can see that there are many executable scripts:
reset-admin.sh
reset administratorseafile.sh
seafile service scriptseahub.sh
seahub website scriptsetup-seafile-mysql.sh
Initialize mysql scriptsetup-seafile.sh
Initialize seafile script- …
Starting here seafile
Still need to do some initialization operations
4.2 Follow Mysql
Becauseseafile
requires a persistent database, data is stored here throughmysql
, so we need to install it in advance
- Install
sudo apt-get install mysql-server
- change Password
The default password is empty
sudo mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
4.3 Initialize Mysql
Here we run:
./setup-seafile-mysql.sh
This script will prompt us to perform step-by-step initialization operations
First we will be asked to enter our service name, and then configure the port. The default is 8082
Here we will choose to create a new database or use an existing one. This is our first deployment, so just create a new one and enter the service configuration ofmysql
as prompted. IP, account password
---------------------------------This is your configuration---------------------------------
server name: seafile
server ip/domain: 3.36.53.6
seafile data dir: /home/ubuntu/seafile-data
fileserver port: 8082
database: create new ccnet
database: ccnet-db
seafile database: seafile-db
seahub database: seahub-db
database user: seafile
The initialization operation of Mysql
is completed here. You can see how to start the service here.
run seafile server: ./seafile.sh {
start | stop | restart }
run seahub server: ./seahub.sh {
start <port> | stop | restart <port> }
Startseafile server
Just execute: ./seafile.sh start
Startseahub server
Just execute: ./ seahub.sh start
5. Run Seafile and preview
5.1 Initialize seafile
- Execute initialization script
./setup-seafile.sh
Here we will be prompted that we do not have sqllite3
, we need to install the dependencies
- Install sqlite3
apt-get install sqlite3
Then re-execute the initialization to complete the detection
5.2 Start seafile server and seahub
- Start command
./seafile.sh start
The above status is that the startup is completed, and then we start to start seahub
./seahub.sh start
Here we will set up the management account and password, which will be used to log in later. After all startup is completed, we can access port 8000 to see the background system page
5.3 Preview seahub
Passip + port 8000, enter it into the browser to complete the access. You may not be able to access it here because the firewall does not Release the 8000
port, which can be released from networking
in the instance details
5.4 Open port 8000
6. Summary
After several twists and turns, our joint test of Lightsail
and Seafile
was a complete success. It can be seen from the testing process thatLightsail
's infrastructure ensures the stability ofSeafile
's various indicators. The easy-to-useLightsail
management interface also makesSeafile
one-click deployment possible. In addition, the security and availability of the system are also guaranteed through Amazon Cloud performance monitoring and inspection functions. I believe that in the future we can better serve the needs of team collaboration based onLightsail
. At the same time, I would also like to thank Amazon Cloud for providing such a good platform for practical learning and verification. Participating in the assessment this time also gave us valuable learning experience. If future projects have similar needs, cloud deployment will be the first choice. This will be an important reference case for our future cloud applications.