시나리오
0. 디스크 설정
- OS 설치할 메인 디스크 : Mem 4GB / Disk 40GB
- (메인 디스크를 제외하고) 100MB 디스크 6개 추가
=> 디스크 4개는 RAID 작업
Rocky9 : RAID 1+0
Ubuntu : RAID 0+1
=> 디스크 1개는 DiskQuota 적용 후 파일 업로드하여 테스트
=> 디스트 1개는 iSCSI 용도로 사용
1. OS 초기화
- selinux 설정
- 방화벽 끄기
- SSH PermitrootRogin 허용
- remi, epel 리포지터리 정리
- 업데이트 && 업그레이드
2. httpd, apache2 설치
3. php 설치
- /var/www/html 아래에 phpinfo.php 파일을 만든 후 테스트
4. DBMS 설치 (Rocky9에만 설치)
- 실습은 MariaDB로 진행
- 설치 후, 기본 보안 세팅 진행
- 세팅 후, 계정 생성
- 계성 생성 후, DB 생성
- 만든 DB에 계정 허용
- 계정 적용 (초기화)
5. phpmyadmin 설치 (Rocky9)
6. DNS
- rfc파일에 본인 zone파일 등록
- rfc파일에 등록한 이름에 맞게 zone파일 생성 (phpmyadmin만 해당, owncloud는 도메인 등록할 필요 없음)
- vhost 파일 생성
- 재시작 후 도메인으로 접속해보기
7. iSCSI 구축
- 리눅스에 구축 후 본인 윈도우로 테스트
8. owncloud 설치 (Ubuntu)
- Rocky9의 DB를 사용 (원격 구축)
0. 디스크 설정
Ubuntu
VM설치
Raid구성
root@ubuntukaya:/mnt# fdisk -l
Disk /dev/loop0: 4 KiB, 4096 bytes, 8 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 269.77 MiB, 282873856 bytes, 552488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop2: 10.72 MiB, 11239424 bytes, 21952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop3: 74.27 MiB, 77881344 bytes, 152112 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop4: 505.09 MiB, 529625088 bytes, 1034424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop5: 91.69 MiB, 96141312 bytes, 187776 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop6: 38.83 MiB, 40714240 bytes, 79520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop7: 10.54 MiB, 11051008 bytes, 21584 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/fd0: 1.41 MiB, 1474560 bytes, 2880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090
Device Boot Start End Sectors Size Id Type
/dev/fd0p1 2425393296 4850786591 2425393296 1.1T 90 unknown
/dev/fd0p2 2425393296 4850786591 2425393296 1.1T 90 unknown
/dev/fd0p3 2425393296 4850786591 2425393296 1.1T 90 unknown
/dev/fd0p4 2425393296 4850786591 2425393296 1.1T 90 unknown
Disk /dev/sda: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 7524DF9F-4977-4C39-82DE-F60D270C5D86
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 83884031 83879936 40G Linux filesystem
Disk /dev/sdb: 102 MiB, 106954752 bytes, 208896 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 102 MiB, 106954752 bytes, 208896 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 102 MiB, 106954752 bytes, 208896 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdf: 102 MiB, 106954752 bytes, 208896 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdg: 102 MiB, 106954752 bytes, 208896 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdd: 102 MiB, 106954752 bytes, 208896 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop8: 500 KiB, 512000 bytes, 1000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md1: 200 MiB, 209715200 bytes, 409600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk /dev/md2: 200 MiB, 209715200 bytes, 409600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
Disk /dev/md3: 199 MiB, 208666624 bytes, 407552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 524288 bytes / 1048576 bytes
root@ubuntukaya:/mnt# df
파일 시스템 1K-블록 사용 가용 사용% 마운트위치
tmpfs 396108 2124 393984 1% /run
/dev/sda2 40970464 9647588 29209496 25% /
tmpfs 1980524 0 1980524 0% /dev/shm
tmpfs 5120 8 5112 1% /run/lock
tmpfs 396104 132 395972 1% /run/user/1000
/dev/sr0 90084 90084 0 100% /media/kaya/CDROM
/dev/sr1 6057964 6057964 0 100% /media/kaya/Ubuntu 24.04.1 LTS amd64
tmpfs 396104 80 396024 1% /run/user/0
/dev/md3 174432 24 160148 1% /mnt
Diskquota
root@ubuntukaya:/mnt# quota -v quodta
Disk quotas for user quodta (uid 1001):
Filesystem blocks quota limit grace files quota limit grace
/dev/md3 0 8192 10249 0 0 0
1. Initialization
Ubuntu
SSH PermitRootLogin
Rocky9
Remi/Epel Repo Install
[root@localhost yum.repos.d]# dnf repolist
저장소 ID 저장소 이름
appstream Rocky Linux 9 - AppStream
baseos Rocky Linux 9 - BaseOS
epel Extra Packages for Enterprise Linux 9 - x86_64
epel-cisco-openh264 Extra Packages for Enterprise Linux 9 openh264 (From Cisco) - x86_64
extras Rocky Linux 9 - Extras
remi-modular Remi's Modular repository for Enterprise Linux 9 - x86_64
remi-safe Safe Remi's RPM repository for Enterprise Linux 9 - x86_64
SSH PermitRootLogin
SELINUX
[root@localhost ~]# sestatus
SELinux status: disabled
Firewalld
[root@localhost ~]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; prese>
Active: inactive (dead)
Docs: man:firewalld(1)
11월 01 15:01:57 localhost systemd[1]: Starting firewalld - dynamic firewall da>
11월 01 15:01:57 localhost systemd[1]: Started firewalld - dynamic firewall dae>
11월 01 15:04:35 localhost.localdomain systemd[1]: Stopping firewalld - dynamic>
11월 01 15:04:35 localhost.localdomain systemd[1]: firewalld.service: Deactivat>
11월 01 15:04:35 localhost.localdomain systemd[1]: Stopped firewalld - dynamic >
lines 1-10/10 (END)
2. Apache2/httpd Install
Ubuntu Apache2
Rocky 9 HTTP
3. PHP Install
Ubuntu ( 7.4 )
Rocky 9 ( 8.0 )
4. DBMS(Mariadb) Install
Rocky 9
[root@localhost html]# 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
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the 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] n
... skipping.
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] n
... skipping.
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!
MariaDB [(none)]> show grants for 'r9db'@'%';
+-----------------------------------------------------------------------------------------------------+
| Grants for r9db@% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `r9db`@`%` IDENTIFIED BY PASSWORD '*1B6D4B98A6D6E9AA64400F85B63237CA840D5D02' |
| GRANT ALL PRIVILEGES ON `r9db`.* TO `r9db`@`%` |
+-----------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)
5. phpMyAdmin Install
Rocky 9
6. DNS Server
Ubuntu(ubuntu.com)
C:\Users\tj>nslookup ns.ubuntu.com 172.16.20.121
서버: UnKnown
Address: 172.16.20.121
이름: ns.ubuntu.com
Address: 172.16.20.121
Rocky 9(rocky.com)
C:\Users\tj>nslookup ns.rocky.com 172.16.20.122
서버: UnKnown
Address: 172.16.20.122
이름: ns.rocky.com
Address: 172.16.20.122
7. ISCSI
Ubuntu(server)
/> ls
o- / ..................................................................... [...]
o- backstores .......................................................... [...]
| o- block .............................................. [Storage Objects: 1]
| | o- block_disk ................. [/dev/sdf (102.0MiB) write-thru activated]
| | o- alua ............................................... [ALUA Groups: 1]
| | o- default_tg_pt_gp ................... [ALUA state: Active/optimized]
| o- fileio ............................................. [Storage Objects: 1]
| | o- fileid_disk ............ [/tmp/fileiod (5.0MiB) write-thru deactivated]
| | o- alua ............................................... [ALUA Groups: 1]
| | o- default_tg_pt_gp ................... [ALUA state: Active/optimized]
| o- pscsi .............................................. [Storage Objects: 0]
| o- ramdisk ............................................ [Storage Objects: 0]
o- iscsi ........................................................ [Targets: 1]
| o- iqn.2024-11.com.ubuntu.target:ubuntu-target ................... [TPGs: 1]
| o- tpg1 ........................................... [no-gen-acls, no-auth]
| o- acls ...................................................... [ACLs: 1]
| | o- iqn.2024-11.com.ubuntu.initiator:ubuntu-initiator [Mapped LUNs: 1]
| | o- mapped_lun0 ........................ [lun0 block/block_disk (rw)]
| o- luns ...................................................... [LUNs: 1]
| | o- lun0 ............. [block/block_disk (/dev/sdf) (default_tg_pt_gp)]
| o- portals ................................................ [Portals: 1]
| o- 0.0.0.0:3260 ................................................. [OK]
o- loopback ..................................................... [Targets: 0]
o- vhost ........................................................ [Targets: 0]
/>
8. Owncloude Install
'네트워크 및 서버 > 서버' 카테고리의 다른 글
Clamav / Amavis (0) | 2024.11.25 |
---|---|
Web(Apache) SSL 인증서 발급 및 적용 (0) | 2024.11.15 |
SNMP(Agent) 설정 / MRTG, Cacti 설치 (0) | 2024.10.25 |
SNMP (0) | 2024.10.25 |
Mail서버 구축 - Postfix/Dovecot (2) (0) | 2024.10.18 |