본문 바로가기
IT

M600 Trans2 Server 재설치

by Oh.mogilalia 2024. 12. 30.

00. nano /etc/hostname  -> Trans2

01. root 계정 활성화  'sudo passwd root

02.  nano /etc/ssh/sshd_config
Port 8723
PermitRootLogin yes
PasswordAuthentication yes
service ssh reload

03. 나머지 여유 디스크 공간 NTFS로  파티션 설정
fdisk /dev/sda

이제 다시 아까 했던 것 처럼 n을 눌러 파티션을 만들어준다. 선택은 모두 엔터만 입력해서 기본값으로 입력한다.
이번에는 파티션을 제대로 생성하긴 했는데, 파티션 타입이 Linux filesystem이다.
윈도우와의 호환을 위해 NTFS 로 포맷중이기때문에, 이왕이면 파티션 타입도 변경해보자.
타입 변경을 위해 t를 입력한다.
그러면 파티션 타입 혹은 alias를 입력하라고 하는데, L을 입력해서 확인 해 보면

다양한 파티션 타입이 나온다. 이 중 11번에 있는 Microsoft basic data 로 변경을 해보겠다.
q를 입력 해 빠져나오고, 11을 입력해 타입을 선택한다.
Changed type of partition 'Linux filesystem' to 'Microsoft basic data'.
타입이 정상적으로 변경되었다. 그러면 이제 p를 입력해서 현재의 파티션 테이블을 출력해보자.
/dev/sda 파티션이 Microsoft basic data 타입으로 잘 생성되었다.
이제 w를 입력해서 저장해준다.
fdisk는 실제로 w를 입력해 저장하기 전까지는 메모리에만 변경사항이 저장되며 실제로 파티션을 변경하지는 않는다.

1. 파티션 없애고 custom storage layout 선택 후 일단 설치

2. HDD 떼어내고 Windows에서 Trans2 파티션 ntfs로 새로 지정 후 재설치

3. /media 에 hdd 디렉토리 생성

3-1 /media에 ssd 디렉토리 색성

4. ntfs-3g 설치 apt install ntfs-3g

5. blkid 
root@trans2:/home/mogilalia# blkid
/dev/sdb2: UUID="4a71c2af-5f64-4657-8231-930be380826c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="95d23325-7fd6-4a79-8601-e189951142f4"
/dev/sdb3: UUID="6eacc848-de2e-4c46-aa3d-0506d555ee41" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3270187b-0ff8-4fd3-9958-eb615c1f122a"
/dev/sdb1: UUID="6F04-3271" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="24de4e87-e849-4a18-b390-24390a0f77c1"
/dev/sda2: BLOCK_SIZE="512" UUID="01DB278BA59CB690" TYPE="ntfs" PARTUUID="a40fd3aa-0cb4-849f-ac9b-cbb535e86989"
/dev/sda1: UUID="8C2C-6468" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="29bfcd8e-6858-4be8-8b74-51bee52bc141"
/dev/sdb4: PARTUUID="c3535c51-80ec-431d-8b7c-904d97f9ffdd"

/dev/sda3: BLOCK_SIZE="512" UUID="01DB278BA59CB690" TYPE="ntfs" PARTUUID="a40fd3aa-0cb4-849f-ac9b-cbb535e86989"

5-1 ntfs 포맷
mkfs.ntfs -f /dev/sdb4

5-1 ntfs mount
mount -t ntfs-3g /dev/sda2 /media/hdd
mount -t ntfs-3g /dev/sdㅠ4 /media/ssd

5-2 결과
root@trans2:/media/hdd# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0   1.8T  0 disk
├─sda1   8:1    0     1G  0 part
└─sda2   8:2    0   1.8T  0 part /media/hdd
sdb      8:16   0 238.5G  0 disk
├─sdb1   8:17   0     1G  0 part /boot/efi
├─sdb2   8:18   0     5G  0 part /boot
├─sdb3   8:19   0    50G  0 part /
└─sdb4   8:20   0 182.4G  0 part /media/ssd

6. fstab 추가 편집 
UUID=01DB278BA59CB690 /media/hdd ntfs-3g defaults 0 0
UUID=7256AA3805792F4C /media/ssd ntfs-3g defaults 0 0

7. Transmission daemon 설치
apt install transmission-daemon

7-1 설치 후 에러가 나길래
 nano /etc/systemd/system/multi-user.target.wants/transmission-daemon.service
Type=notify 을 Type=simple 로 수정한다.
그랬더니 된다. (2024.10.30. 23:27)
I changed the .service file from 'Type=notify' to 'Type=exec' and it seems to function correctly. (I guess missing whatever sd-notify was doing).

nano /etc/systemd/system/multi-user.target.wants/transmission-daemon.service
====================================
기존 내용
[Unit]
Description=Transmission BitTorrent Daemon
Wants=network-online.target
After=network-online.target

[Service]
User=debian-transmission
Type=simple
ExecStart=/usr/bin/transmission-daemon -f --log-level=error
ExecReload=/bin/kill -s HUP $MAINPID
NoNewPrivileges=true
MemoryDenyWriteExecute=true
ProtectSystem=true
PrivateTmp=true

[Install]
WantedBy=multi-user.targe
================================
odroid 내용
[Unit]
Description=Transmission BitTorrent Daemon
After=network.target

[Service]
User=debian-transmission
Type=notify
ExecStart=/usr/bin/transmission-daemon -f --log-error
ExecStop=/bin/kill -s STOP $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID

[Install]
WantedBy=multi-user.target
========================
복사 변경하니 되는데....

 

root@rans2:/etc# systemctl daemon-reload
root@rans2:/etc# service transmission-daemon status
● transmission-daemon.service - Transmission BitTorrent Daemon
     Loaded: loaded (/usr/lib/systemd/system/transmission-daemon.service; enabled; preset: enabled)
     Active: activating (start) since Wed 2024-10-30 23:26:07 KST; 51s ago
   Main PID: 6926 (transmission-da)
      Tasks: 3 (limit: 9339)
     Memory: 2.4M (peak: 2.9M)
        CPU: 353ms
     CGroup: /system.slice/transmission-daemon.service
             └─6926 /usr/bin/transmission-daemon -f --log-level=error

Oct 30 23:26:07 rans2 systemd[1]: Starting transmission-daemon.service - Transmission BitTorrent Daemon...

8. nano /etc/transmission-daemon/settings.json

◆ nano 편집기를 이용해서 아래 설정 변경
root@Trans2:~# cat /etc/transmission-daemon/settings.json
{
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "announce-ip": "",
    "announce-ip-enabled": false,
    "anti-brute-force-enabled": false,
    "anti-brute-force-threshold": 100,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "blocklist-url": "http://www.example.com/blocklist",
    "cache-size-mb": 128,
    "default-trackers": "",
    "dht-enabled": true,
    "download-dir": "/media/hdd",
    "download-limit": 100,
    "download-limit-enabled": 0,
    "download-queue-enabled": true,
    "download-queue-size": 100,
    "encryption": 1,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/media/hdd",
    "incomplete-dir-enabled": true,
    "lpd-enabled": false,
    "max-peers-global": 200,
    "message-level": 2,
    "peer-congestion-algorithm": "",
    "peer-limit-global": 200,
    "peer-limit-per-torrent": 50,
    "peer-port": 51413,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": "le",
    "pex-enabled": true,
    "port-forwarding-enabled": false,
    "preallocation": 1,
    "prefetch-enabled": true,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 2,
    "ratio-limit-enabled": false,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-host-whitelist": "",
    "rpc-host-whitelist-enabled": true,
    "rpc-password": "diordo",
    "rpc-port": 9091,
    "rpc-socket-mode": "0750",
    "rpc-url": "/transmission/",
    "rpc-username": "root",
    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": false,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-added-enabled": false,
    "script-torrent-added-filename": "",
    "script-torrent-done-enabled": true,
    "script-torrent-done-filename": "",
    "script-torrent-done-seeding-enabled": false,
    "script-torrent-done-seeding-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 0,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 0,
    "speed-limit-up-enabled": false,
    "start-added-torrents": true,
    "tcp-enabled": true,
    "torrent-added-verify-mode": "fast",
    "trash-original-torrent-files": true,
    "umask": "000",
    "upload-limit": 10,
    "upload-limit-enabled": 0,
    "upload-slots-per-torrent": 14,
    "utp-enabled": true,
    "watch-dir": "/media/hdd",
    "watch-dir-enabled": true
}

root@trans2:~#

service transmission-daemon status 에러의 경우 위 설정 파일에서 조정

9. Samba 설정
apt install samba

smbpasswd -a root 
비번 지정 후

/etc/samba/smb.conf
192.168.0.122
[root]
path = /media/hdd
writable = yes
create mask = 0755
directory mask = 0755
valid users = root
write cache size = 524288
getwd cache = yes
use sendfile = yes

[mogilalia]
path = /media/hdd
writable = yes
create mask = 0755
directory mask = 0755
valid users = root
write cache size = 524288
getwd cache = yes
use sendfile = yes

192.168.0.9
[root]
path = /media/hdd3
writable = yes
create mask = 0755
directory mask = 0755
valid users = root
write cache size = 524288
getwd cache = yes
use sendfile = yes

[mogibu]
path = /media/hdd2/data
writable = yes
create mask = 0755
directory mask = 0755
valid users = root
write cache size = 524288
getwd cache = yes
use sendfile = yes

192.168.0.84
[mogibu]
comment = mogibu's Data
path = /home/bckup
valid users = mogibu
writable = yes
create mask = 0644
directory mask = 0755

10. ssh Root 접속 가능하게

nano /etc/ssh/sshd_config
--------------------------------------
Include /etc/ssh/sshd_config.d/*.conf

Port 8723
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no

11. LG TV  Plex Media Server 관련 설정
0) apt install --only-upgrade plexmediaserver
https://www.plex.tv/media-server-downloads/?cat=computer&plat=linux
1) 위 서버에서 우분투 Intel AMD 64Bit deb 파일을 다운로드 후
2) dpkg -i plexmediaserver_1.41.1.9057-af5eaea7a_amd64.deb 설치 후
3) systemctl status plexmediaserver  Active 상태 확인
4) 브라우저 주소창에 192.168.0.122:32400/web 입력 후 라이브러리 폴더 등 설정

12. Ubuntu 서버에 Pro 라이센스키 등록

https://ubuntu.com/pro
Standard Support 기간이 지난 서버에는 반드시 하시고, 기간이 남아있는 서버도 Pro를 활성화 하면 더 빠른 보안패치를 받을 수 있다고 합니다.

pro attach MY-LICENSE-KEY