Server setup
1. Boot Magnager 접속
USB 미디어를 꼽고 전원 켠 후 F11을 선택하여 Boot Manager에 액세스 https://www.dell.com/support/kbdoc/ko-kr/000215276/poweredge-red-hat-enterprise-linux%EB%A5%BC-%EC%9C%84%ED%95%9C-%EC%84%A4%EC%B9%98-%EB%B6%80%ED%8C%85-%EA%B0%80%EB%8A%A5%ED%95%9C-usb-%EB%AF%B8%EB%94%94%EC%96%B4-%EB%A7%8C%EB%93%A4%EA%B8%B0
- One-shot UEFI Boot Menu
- Disk connected to front USB를 선택하여 운영 체제 설치를 시작
2. 기본 도구 설치
- 설치 전 디스플레이 해상도 변경 1024 X 768
- 포트 번호 변경 193 ```bash ls -la /etc/netplan/ // 파일명 확인
// 파일명에 따라 /netplan 이하 변경 sudo nano /etc/netplan/01-netcfg.yaml sudo nano /etc/netplan/01-network-manager-all.yaml
*** 설정 내용
network: version: 2 renderer: NetworkManager ethernets: enp0s3: # 실제 인터페이스 이름으로 변경 (ip a로 확인) dhcp4: no addresses: - 192.168.1.193/24 # 원하는 IP 주소 routes: - to: default via: 192.168.1.1 # 게이트웨이 주소 nameservers: addresses: - 8.8.8.8 - 8.8.4.4
```bash
sudo apt update
sudo apt install net-tools
sudo apt install openssh-server
sudo apt install ufw
//활성화 및 시작
sudo systemctl start ssh
sudo systemctl enable ssh
sudo ufw enable
// mini PC 포트 허용
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 1883/tcp
// Main PC 포트 허용
sudo ufw allow 3306 # MariaDB
sudo ufw allow 1883 # Mosquitto MQTT
sudo ufw allow 9001 # Mosquitto WebSocket
sudo ufw allow 5672 # RabbitMQ
sudo ufw allow 15672 # RabbitMQ Management
sudo ufw allow 25672
sudo ufw allow 6379 # Redis
sudo ufw allow 80 # nginx HTTP
sudo ufw allow 443 # nginx HTTPS
//ip 확인
hostname -I
//curl 설치
sudo apt install -y curl
→ 확인 후 재부팅. ssh 접속 확인 ssh cims@192.168.1.193
3. Node.js
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
exit //세션 한 번 나가줄 것
nvm list-remote --lts
nvm install 18.20.2
nvm alias defualt 18.20.2
npm --version
4. PM2
npm install -g pm2@5.2.2
pm2 --version
pm2 startup
// 이하 출력되는 환경변수 다시 한 번 더 입력
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/home/cims/.nvm/versions/node/v18.20.2/bin /home/cims/.nvm/versions/node/v18.20.2/lib/node_modules/pm2/bin/pm2 startup systemd -u cims --hp /home/cims
5. MariaDB
// Mariadb 10.11 다운로드
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="10.11"
sudo apt install -y mariadb-server mariadb-client
sudo systemctl start mariadb
// 최초 비번 설정
sudo mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '##hnic123';
FLUSH PRIVILEGES;
//외부에서 root 접속 허용
CREATE USER 'root'@'%' IDENTIFIED BY '##hnic123';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
//접속 테스트
mysql -u root -p'##hnic123' -h 192.168.1.193 --skip-ssl
- 50-server.cnf 수정 경로 : cd /etc/mysql/mariadb.conf.d/50-server.cnf ```bash sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
// 이하 conf 파일
These groups are read by MariaDB server.
Use it for options that only the server (but not clients) should see
this is read by the standalone daemon and embedded servers
[server]
[mysql] default-character-set = utf8mb4
this is only for the mysqld standalone daemon
[mysqld]
#
* Basic Settings
#
#user = mysql pid-file = /run/mysqld/mysqld.pid basedir = /usr #datadir = /var/lib/mysql #tmpdir = /tmp character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci event_scheduler = ON lower_case_table_names = 0
Broken reverse DNS slows down connections considerably and name resolve is
safe to skip if there are no “host by domain name” access grants
#skip-name-resolve
Instead of skip-networking the default is now to listen only on
localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1 bind-address = 0.0.0.0
// 설정파일 수정 후 반드시 리스타트 sudo systemctl restart mariadb sudo systemctl enable mariadb
## 6. Redis
```bash
sudo apt-get install redis-server
sudo systemctl start redis-server
//설정파일 변경
sudo nano /etc/redis/redis.conf
// 기본 포트 수정
#bind 127.0.0.1 -::1
bind 0.0.0.0 -::1
// 비밀번호 수정
requirepass 33hnic123
// 설정파일 수정 후 반드시 리스타트
sudo systemctl restart redis-server
sudo systemctl enable redis-server
// 연결 테스트
redis-cli -a ##123 ping
redis-cli
# 접속 후
127.0.0.1:6379> AUTH ##123
OK
127.0.0.1:6379> ping
PONG
redis-server --version
7. Mosquitto 설치
sudo apt install -y mosquitto mosquitto-clients
sudo systemctl daemon-reload
sudo systemctl ensudoable mosquitto
sudo systemctl start mosquitto
# mosquitto 사용자 추가 -> 명령어 실행 이후 password 두번 입력해야함
sudo mosquitto_passwd -c /etc/mosquitto/passwd [username]
# 파일 권한 변경 (프로세스에서 파일을 열지 못하는 경우가 발생)
sudo chmod 0700 ./passwd // 안되면 644로 재시도
#sudo chmod 644 ./passwd
# 설정
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example
#pid_file /run/mosquitto/mosquitto.pid
#persistence true
#persistence_location /var/lib/mosquitto/
persistence false
log_dest file /var/log/mosquitto/mosquitto.log
log_dest stdout
include_dir /etc/mosquitto/conf.d
allow_anonymous false
password_file /etc/mosquitto/passwd
listener 1883
listener 9001
protocol websockets
sudo apt install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
nginx -version
9. RabbitMQ
sudo apt install -y erlang
sudo apt-get install rabbitmq-server
sudo systemctl start rabbitmq-server
sudo systemctl enable rabbitmq-server
This line appears after every note.
Notes mentioning this note
There are no notes linking to this note.