서버모니터 앱 - 백엔드 서버 설치 가이드(Install manual)
< How to Install Backend Server >
--
Summary—
<Update
OS>
<Install
Python and Pip>
<Set
Up the Backend Server >
<Run
app.py = After modificatying app.py, follow this procedures >
Etc:
Source code location: nolgaemi.github.io
--
Detailed Procedures –
<Files
Location>
(server-monitor-env) [root@BackEnd-Server instance]# pwd
/root/server-monitor/instance
(server-monitor-env) [root@BackEnd-Server instance]# ll
total 12
-rw-r--r--. 1 root root 12288 Aug 2 10:34 agent_data.db
(server-monitor-env) [root@BackEnd-Server server-monitor]#
pwd
/root/server-monitor
(server-monitor-env) [root@BackEnd-Server server-monitor]#
ll
total 16
-rw-r--r--. 1 root root 3671 Jul 23 17:14 app.py
-rw-r--r--. 1 root root
125 Jul 16 16:34 config.py
drwxr-xr-x. 2 root root
27 Aug 2 10:36 instance
-rw-r--r--. 1 root root
189 Jul 23 13:21 manage.py
-rw-------. 1 root root
46 Jul 18 14:46 nohup.out
drwxr-xr-x. 2 root root
61 Jul 23 17:15 __pycache__
(server-monitor-env) [root@BackEnd-Server
server-monitor-env]# pwd
/root/server-monitor-env
(server-monitor-env) [root@BackEnd-Server
server-monitor-env]# ll
total 8
drwxr-xr-x. 2 root root 4096 Jul 17 17:44 bin
drwxr-xr-x. 3 root root
18 Jul 16 16:31 include
drwxr-xr-x. 3 root root
23 Jul 16 16:31 lib
lrwxrwxrwx. 1 root root
3 Jul 16 16:31 lib64 -> lib
-rw-r--r--. 1 root root
70 Jul 16 16:31 pyvenv.cfg
<Update
OS>
▧ Update OS
sudo dnf update -y
<Install
Python and Pip>
▧ Install Python and pip
sudo dnf install python3 python3-pip -y
<Set
Up the Backend Server >
▧ Get python code
Locate app.py as the file location above(files location)
▧ Get python code
Manually copy your project files
(app.py
, config.py
, manage.py
, and the instance/
directory) into /root/server-monitor
.
For example, you can use scp
to copy files from your local machine to the server, or directly copy them if
they are already on the server.
/root/
├──
server-monitor/
│ ├──
app.py
│ ├──
config.py
│ ├──
instance/
│ │ └──
agent_data.db
│ ├──
manage.py
│ └──
__pycache__/
├──
server-monitor-env/
│ ├──
bin/
│ ├──
include/
│ ├──
lib/
│ └──
pyvenv.cfg
· app.py: This is your main Flask
application file.
· config.py: This file likely contains configuration
settings for your Flask application.
· instance/: This directory contains instance-specific files, such as
the SQLite database (agent_data.db).
· manage.py: This script might be used to manage your Flask application (e.g., database migrations,
running a development server).
· __pycache__/: This directory contains compiled
Python bytecode files.
▧ Install Python and pip
sudo dnf install python3 python3-pip -y
▧ Install Dependencies
pip install flask flask-restful
psutil
▧ Create a Virtual
Environment
python3 -m venv /root/server-monitor-env
source /root/server-monitor-env/bin/activate
<Run
app.py = After modificatying app.py, follow this procedures >
▧ Navigate to your project directory:
cd /root/server-monitor
▧ Activate the virtual environment:
source /root/server-monitor-env/bin/activate
▧ Run your Flask application:
python app.py
댓글
댓글 쓰기