DevOps Challenge
๐ฅ ๋ค์ด๊ฐ๋ฉฐ
DevOps๋ก ๋์๊ฐ๊ธฐ ์ํด ์ฑ๋ฆฐ์ง๋ฅผ ์์ํ๋ค. ์ด ๊ณณ์์ ์งํ์ค์ด๋ค. 100์ผ ์ฑ๋ฆฐ์ง์ธ๋ฐ ๋งค์ผ ์ด ๊ธ์ ๊ธฐ๋กํ๋ ค ํ๋ค.
Day1 - Linux User Setup with Non-Interactive Shell
Overview
| Item | Description |
|---|---|
| Date | 2026-05-30 Sat. |
| Category | Linux / User Management |
| Difficulty | Easy |
| Environment | KodeKloud / Nautilus |
| Keywords | useradd, nologin, non-interactive shell |
Problem
To accommodate the backup agent toolโs specifications, the system admin team at
xFusionCorp Industriesrequires the creation of a user with a non-interactive shell. Hereโs your task:Create a user named
mariyamwith a non-interactive shell onApp Server1.
Explanation
๋ฌธ์ ์ ์๊ตฌ์ฌํญ์
App Server 1์ mariyam ์ด๋ผ๋ ์ฌ์ฉ์๋ฅผ ์์ฑํ๋๋ฐ, ๋ก๊ทธ์ธ ๊ฐ๋ฅํ ์ผ๋ฐ ์์ด ์๋๋ผ
๋น๋ํํ(non-interactive) shell๋ก ์ค์ ํ๋ผ
๋ ๋ป์ด๋ค.
๋ณดํต ๋ฆฌ๋ ์ค์์ ๋ก๊ทธ์ธ ๋ชป ํ๋ ๊ณ์ ์ ๋ง๋ค ๋ ์ฌ์ฉํ๋ค. ์๋ฅผ ๋ค์ด, ๋ฐฑ์ ์์ด์ ํธ, ์์คํ ์๋น์ค, ๋ฐ๋ชฌ ๊ณ์ ๊ณผ ๊ฐ์ ๊ฒ๋ค์ ํ์ผ ๊ถํ๋ง ํ์ํ์ง ์ฌ๋์ด SSH ๋ก๊ทธ์ธํ ํ์๋ ์๊ธฐ ๋๋ฌธ์ด๋ค. ์ผ๋ฐ์ ์ผ๋ก ์๋์ ์์ ์ฌ์ฉํ๋ค.
/sbin/nologin/usr/sbin/nologin/bin/false
์ผ๋ฐ์ ์ผ๋ก nologin์ ๋ง์ด ์ฌ์ฉํ๋ค๊ณ ํ๋ค.
์ถ๊ฐ๋ก non-interactive shell์ ๋จ์ํ โ๋ก๊ทธ์ธ์ ๋ง๋ ๊ฒโ ์ด์์ ์๋ฏธ๋ฅผ ๊ฐ์ง๋ค.
Linux์์๋ ์๋น์ค ์คํ์ฉ ๊ณ์ ์ด๋ ์์คํ
๊ณ์ ์ ์์ฑํ ๋ ๋ณด์์ ์ํด ๋ก๊ทธ์ธ ๊ธฐ๋ฅ์ ์ ํํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง๋ค. ๋ง์ฝ ์ผ๋ฐ shell(/bin/bash ๋ฑ)์ ๋ถ์ฌํ๋ฉด ํด๋น ๊ณ์ ์ผ๋ก SSH ๋ก๊ทธ์ธ์ด๋ shell ์ ๊ทผ์ด ๊ฐ๋ฅํด์ง ์ ์๊ธฐ ๋๋ฌธ์ด๋ค.
๋ฐ๋ฉด nologin์ด๋ false๋ฅผ ์ฌ์ฉํ๋ฉด ๊ณ์ ์์ฒด๋ ์กด์ฌํ์ง๋ง interactive shell ์ธ์
์ ์์ํ ์ ์๊ฒ ๋๋ค. ์ฆ, ํ๋ก์ธ์ค ์คํ์ด๋ ํ์ผ ๊ถํ ๊ด๋ฆฌ ์ฉ๋๋ก๋ ์ฌ์ฉํ ์ ์์ง๋ง ์ฌ๋์ด ์ง์ ๋ก๊ทธ์ธํ ์๋ ์๋ค.
ํนํ /sbin/nologin์ ๋ก๊ทธ์ธ ์๋ ์ ์๋ด ๋ฉ์์ง๋ฅผ ์ถ๋ ฅํ ๋ค ์ข
๋ฃํ๋ฉฐ, /bin/false๋ ์๋ฌด ๋ฉ์์ง ์์ด ์ฆ์ ์ข
๋ฃ๋๋ค๋ ์ฐจ์ด๊ฐ ์๋ค.
์ค์ ์ด์ ํ๊ฒฝ์์๋ ๋ค์๊ณผ ๊ฐ์ ๊ณ์ ๋ค์ ๋๋ถ๋ถ non-interactive shell์ ์ฌ์ฉํ๋ค.
- nginx
- mysql
- postgres
- redis
- ftp ์๋น์ค ๊ณ์
- backup agent ๊ณ์
๋ฐ๋ผ์ ์ด๋ฒ ๋ฌธ์ ๋ ๋จ์ ์ฌ์ฉ์ ์์ฑ๋ณด๋ค๋ โ์๋น์ค ๊ณ์ ์ ์์ ํ๊ฒ ์์ฑํ๋ ๋ฐฉ๋ฒโ์ ์ดํดํ๋ ๊ฒ์ด ํต์ฌ์ด๋ผ๊ณ ๋ณผ ์ ์๋ค.
Answer
1
2
3
4
$ ssh tony@stapp01
$ sudo useradd -s /sbin/nologin mariyam
$ grep mariyam /etc/passwd
mariyam:x:1001:1001::/home/mariyam:/sbin/nologin
Day2 - Temporary User Setup with Expiry
Problem
As part of the temporary assignment to the Nautilus project, a developer named
ravirequires access for a limited duration. To ensure smooth access management, a temporary user account with an expiry date is needed. Hereโs what you need to do:Create a user named ravi on App Server 3 in Stratos Datacenter. Set the expiry date to
2027-04-15, ensuring the user is created in lowercase as per standard protocol.Note: You can find the infrastructure details by clicking on the Details of all Users and Servers button on the top-right section of the page.
Explanation
์ด ๋ฌธ์ ๋
ํน์ ๋ ์ง๊น์ง๋ง ์ฌ์ฉํ ์ ์๋ ์์ Linux ๊ณ์ ์ ์์ฑํ๋ผ
๋ผ๋ ๋ป์ด๋ค. ์ง์ ๋ ๋ ์ง ์ดํ์๋ ๊ณ์ ์ด ์๋ ๋ง๋ฃ๋๋๋ก ์ค์ ํด์ผ ํ๋ค.
Linux์์ ์ธ์ฃผ ์ธ๋ ฅ, ๋จ๊ธฐ ํ๋ก์ ํธ ์ธ์, ์์ ์ ๊ทผ ๊ณ์ ๊ฐ์ ์ํฉ์์ ์์ฃผ ์ฌ์ฉํ๋ค.
Answer
-e๋ฅผ ์ฌ์ฉํ๋ฉด ๋ง๋ฃ ๋ ์ง๋ฅผ ์ง์ ํ ์ ์๋ค.
-e: expiry date ์ง์ ์ต์
1
2
3
4
5
6
7
8
9
10
11
$ ssh banner@stapp03
$ sudo useradd -e 2027-04-15 ravi
$ sudo chage -l ravi
Last password change : May 31, 2026
Password expires : never
Password inactive : never
Account expires : Apr 15, 2027
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
Day3 - Secure Root SSH Access
Problem
Following security audits, the
xFusionCorp Industriessecurity team has rolled out new protocols, including the restriction of direct root SSH login.Your task is to disable direct SSH root login on all app servers within the
Stratos Datacenter.
Explanation
์ด ๋ฌธ์ ๋
๋ชจ๋ App Server์์ root ๊ณ์ ์ผ๋ก ์ง์ SSH ๋ก๊ทธ์ธํ๋ ๊ฑธ ๋ง์๋ผ
๋ผ๋ ๋ป์ด๋ค. ๋ณด์์ ssh root@stapp01๋ก ์ ์ํ๋ ๊ฒ์ ๊ธ์งํ๋ ค๋ ๊ฒ์ด๋ค. ๋ณดํต์ ์ผ๋ฐ ์ฌ์ฉ์๋ก ๋ก๊ทธ์ธ ๋๋ sudo ์ฌ์ฉ ๋ฐฉ์์ ๊ฐ์ ํ๋ค.
Answer
๊ฐ ์๋ฒ์ ์ ์ํ์ฌ ์ค์ ์ ์์ ํ๋ฉด ๋๋ค.
1
2
3
4
$ ssh tony@stapp01
$ sudo vi /etc/ssh/sshd_config
# PermitRootLogin yes์์ no๋ก ๋ณ๊ฒฝ
$ sudo systemctl restart sshd
Day4 - Script Execution Permissions
Problem
In a bid to automate backup processes, the
xFusionCorp Industriessysadmin team has developed a new bash script namedxfusioncorp.sh. While the script has been distributed to all necessary servers, it lacks executable permissions onApp Server 3within the Stratos Datacenter.Your task is to grant executable permissions to the
/tmp/xfusioncorp.shscript onApp Server 3. Additionally, ensure that all users have the capability to execute it.
Explanation
์ด ๋ฌธ์ ๋
/tmp/xfusioncorp.shํ์ผ์ ์คํ ๊ถํ(executable permission)์ ์ถ๊ฐํ๋ผ
๋ผ๋ ๋ป์ด๋ค.
Answer
1
2
3
4
5
$ ssh banner@stapp03
$ sudo chmod 755 /tmp/xfusioncorp.sh
$ ls -l /tmp/xfusioncorp.sh
-rwxr-xr-x 1 root root 40 Jun 3 14:39 /tmp/xfusioncorp.sh
์ฒ์์ +x๋ก ํ๋๋ฐ ํ๋ ธ๋ค. ํ์ผ์ ํ์ธํด๋ณด๋ ๊ถํ์ด ---x--x--x์ธ ๋น์ ์์ ์ธ ํํ์๋ค.
Day5 - SElinux Installation and Configuration
Problem
Following a security audit, the xFusionCorp Industries security team has opted to enhance application and server security with SELinux. To initiate testing, the following requirements have been established for
App server 1in theStratos Datacenter:
- Install the required
SELinuxpackages- Permanently disable SELinux for the time being; it will be re-enabled after necessary configuration changes.
- No need to reboot the server, as a scheduled maintenance reboot is already planned for tonight.
- Disregard the current status of SELinux via the command line; the final status after the reboot should be
disabled.
Explanation
SELinux ๊ด๋ จ ํจํค์ง๋ฅผ ์ค์นํ๊ณ , ์ฌ๋ถํ ํ์๋ SELinux๊ฐ ๋นํ์ฑํ(disabled) ์ํ๊ฐ ๋๋๋ก ์ค์ ํ๋ผ
SELinux๋ Linux ๋ณด์ ์์คํ
์ค ํ๋๋ก ์ ์ ๋ช
์นญ์ Security-Enhanced Linux์ด๋ฉฐ, ์๋๋ National Security Agency(NSA)์์ ๊ฐ๋ฐํ๋ค.
๋ณดํต Linux ๊ถํ์ ์ฌ์ฉ์(user), ๊ทธ๋ฃน(group), ํ์ผ ๊ถํ(rwx)์ผ๋ก ์ด๋ฃจ์ด์ ธ ์์ด -rwxr-xr-x์ ๊ฐ์ด ๋๊ฐ ํ์ผ์ ์ฝ์ ์ ์๊ณ ์คํ์ํฌ ์ ์๋์ง ์ ๋๋ก๋ง ๊ด๋ฆฌํ๋ค. ๊ทธ๋ฌ๋ ์ด ๋ฐฉ์๋ง์ผ๋ก๋ ๋ถ์กฑํ ๋๊ฐ ์์ด ๋์จ ๊ฒ์ด SELinux์ด๋ค. ์๋ฅผ ๋ค์ด, nginx ํ๋ก์ธ์ค๊ฐ ํดํน๋จ, root ๊ถํ ํ๋, ์์คํ
ํ์ผ ์ ๊ทผ๊ณผ ๊ฐ์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ๊ฒฝ์ฐ ๊ธฐ์กด ๊ถํ ์ฒด๊ณ๋ง์ผ๋ก๋ ๋ถ์กฑํ๋ค.
SELinux๋ ํ๋ก์ธ์ค๊ฐ ๋ฌด์์ ํ ์ ์๋์ง ๊ฐ์ ๋ก ์ ํํ๋ค. ์ฆ, root๋ผ๋ ๋ชจ๋ ๊ฒ์ ๋คํ ์ ์๋ ๊ฒ์ด ์๋๋ผ๋ ๋ป์ด๋ค.
์๋ฅผ ๋ค์ด, ์ผ๋ฐ Linux์์๋ nginx๊ฐ root๋ฉด ๋ญ๋ ์คํ ๊ฐ๋ฅํ์ง๋ง SELinux๋ nginx๋ ์น ํ์ผ๋ง ์ฝ๋๋ก, DB ์ ๊ทผ ๊ธ์ง, ํน์ ํฌํธ๋ง ์ฌ์ฉ ๊ฐ๋ฅํ๊ฒ ์ ํ์ ๊ฑธ์ด๋์ ์ ์๋ ๊ฒ์ด๋ค.
์ฆ, ์ฌ์ฉ์ ๊ถํ + ํ๋ก์ธ์ค ์ ์ฑ ์ ๋์์ ๊ฒ์ฌํ๋ค.
๊ทธ๋ฐ๋ฐ SELinux๋ ๊ฐ๋ ฅํ์ง๋ง ์ค์ ๋ณต์กํ๊ณ ์์ธ ๋ถ์๊ณผ ์ ๊ทผ์ด ์๋๋ ์ด์ ๋ฅผ ์ฐพ๊ธฐ ์ด๋ ต๋ค๋ ๋จ์ ์ด ์๋ค. ๊ทธ๋์ ๊ฐ๋ฐ ํ๊ฒฝ์์๋ ์ข
์ข
disabled๋ก ๊บผ๋๊ธฐ๋ ํ๋ค.
SELinux ์ํ๋ ์๋์ ๊ฐ์ด ์๋ค.
| ์ํ | ์๋ฏธ |
|---|---|
| Enforcing | ์ ์ฑ ์ ์ฉ + ์ฐจ๋จ |
| Permissive | ์ฐจ๋จ ์ ํจ, ๋ก๊ทธ๋ง ๊ธฐ๋ก |
| Disabled | SELinux ๋นํ์ฑํ |
ํ์ธ ๋ฐฉ๋ฒ์ getenforce๋ฅผ ์
๋ ฅํ๋ฉด ๋๋ค.
Answer
1
2
3
4
5
6
7
8
$ ssh tony@stapp01
$ sudo yum install -y selinux-policy selinux-policy-targeted
$ sudo vi /etc/selinux/config
# SELINUX=disabled๋ก ๊ณ ์น ๊ฒ
#ํ์ธ
$ getenforce
Disabled
Day6 - Create a Cron Job
Problem
The
Nautilussystem admins team has prepared scripts to automate several day-to-day tasks. They want them to be deployed on all app servers inStratos DCon a set schedule. Before that they need to test similar functionality with a sample cron job. Therefore, perform the steps below:a. Install
croniepackage on allNautilusapp servers and startcrondservice. b. Add a cron*/5 * * * * echo hello > /tmp/cron_textforrootuser.
Explanation
๋ชจ๋ App Server์ cron ์๋น์ค๋ฅผ ์ค์นํ๊ณ ์คํํ ๋ค, root ๊ณ์ ์ 5๋ถ๋ง๋ค ์คํ๋๋ cron job์ ๋ฑ๋กํ๋ฉด ๋๋ค.
Answer
1
2
3
4
5
6
7
8
9
10
11
12
# ์๋ ๊ณผ์ ๋ฐ๋ณต
$ ssh tony@stapp01
$ sudo yum install -y cronie
$ sudo systemctl enable crond
$ sudo systemctl start crond
$ sudo crontab -e
# */5 * * * * echo hello > /tmp/cron_text
$ sudo crontab -l
*/5 * * * * echo hello > /tmp/cron_text
Day7 - Linux SSH Authentication
Problem
The system admins team of
xFusionCorp Industrieshas set up some scripts onjump hostthat run on regular intervals and perform operations on all app servers inStratos Datacenter. To make these scripts work properly we need to make sure thethoruser on jump host has password-less SSH access to all app servers through their respective sudo users (i.etonyfor app server 1). Based on the requirements, perform the following:Set up a password-less authentication from user
thoron jump host to all app servers through their respective sudo users.
Explanation
jump-host์ thor ์ ์ ๊ฐ ๋น๋ฐ๋ฒํธ ์ ๋ ฅ ์์ด ๊ฐ App Server์ SSH ์ ์ํ ์ ์๋๋ก ์ค์ ํ๋ผ
์ฒ์์ ์ด๊ฑธ ์ฝ๊ณ ๊ฐ ์๋ฒ๋ง๋ค thor ์ ์ ๋ฅผ ๋ง๋ค์ด์ผํ๋๊ฑด๊ฐ ํ๋ค. ๊ทธ๋ฌ๋ ์ด ๋ป์ thor ๊ณ์ ์ผ๋ก SSH ๋ช ๋ น์ ์คํํ์ ๋ ๋น๋ฐ๋ฒํธ ์์ด ์ ์๋์ด์ผ ํ๋ค๋ ๋ป์ด์๋ค.
์ฆ, ๊ตฌ์กฐ๊ฐ ์๋์ ๊ฐ์ด ๋๋ค.
1
2
3
thor @ jump-host
โ
ssh tony@stapp01
stapp01์ thor ๊ณ์ ์ ๋ง๋๋ ๊ฒ ์๋๋ผ thor์ SSH ๊ณต๊ฐํค๋ฅผ tony ๊ณ์ ์ ๋ฑ๋กํ๋ ๊ฒ์ด๋ค.
ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๊ฐ๋จํ๋ค.
jump-host์์ SSH key๋ฅผ ์์ฑํ ํ ๊ฐ App Server์ ๋ณต์ฌํ๋ฉด ๋๋ค.
1
2
3
thor์ ๊ณต๊ฐํค(id_rsa.pub)
โ
์๊ฒฉ ์๋ฒ ~/.ssh/authorized_keys ์ถ๊ฐ
์ด๊ฑด ์ค๋ฌด์์
- ๋ฐฐํฌ ์๋ํ
- ansible
- backup script
- monitoring
- CI/CD
๋ฑ์ด ์๋ฒ ์ฌ๋ฌ ๋์ ์๋ ์ ์ํ ๋ ์ฌ์ฉ๋๋ค.
์ฆ, ์ฌ๋์ด ๋น๋ฐ๋ฒํธ ์ ๋ ฅ ์ ํด๋ ์คํฌ๋ฆฝํธ๊ฐ ์๋ SSH ๊ฐ๋ฅํ๋๋ก ๋ง๋๋ ๊ฒ์ด๋ค.
Answer
1
2
$ ssh-keygen
$ ssh-copy-id tony@stapp01 # ๋ฐ๋ณต
Day8 - Install Ansible
Problem
During the weekly meeting, the Nautilus DevOps team discussed about the automation and configuration management solutions that they want to implement. While considering several options, the team has decided to go with
Ansiblefor now due to its simple setup and minimal pre-requisites. The team wanted to start testing using Ansible, so they have decided to usejump hostas an Ansible controller to test different kind of tasks on rest of the servers.Install
ansibleversion4.10.0onJump hostusingpip3only. Make sure Ansible binary is available globally on this system, i.e all users on this system are able to run Ansible commands.
Explanation
Jump Host๋ฅผ Ansible Controller๋ก ๋ง๋ค๊ณ , Ansible 4.10.0์ ์ค์นํ๋ผ๋ ๋ป์ด๋ค. Ansible์ ์ค์นํ ๋ค ๋ฌธ์ ์ ๋์จ๋๋ก Make sure Ansible binary is available globally ๊ธ๋ก๋ฒํ๊ฒ ๋ง๋ค์ด์ฃผ๋ฉด ๋๋ค.
๋ฐ๋ผ์ ๊ทธ๋ฅ pip3 install ansible==4.10.0์ ํ ๊ฒฝ์ฐ ์ ๋ช
๋ น์ด๋ฅผ ์
๋ ฅํ ์ฌ์ฉ์๋ง ์ฌ์ฉํ ์ ์๋ค. ์์ sudo๋ฅผ ๋ถ์ฌ ๋ค๋ฅธ ์ฌ์ฉ์๋ ์ฌ์ฉํ ์ ์๊ฒ ํด์ฃผ๋ฉด ๋๋ค.
Answer
1
$ sudo pip3 install ansible==4.10.0
Additional Notes
Ansible์ ์ฌ๋ฌ ์๋ฒ๋ฅผ ์๋์ผ๋ก ๊ด๋ฆฌํ๊ธฐ ์ํ ๋๊ตฌ์ด๋ค. ๋ง์ฝ ๋ฐ์คํฐ์จ ์๋ฒ์์ ์ฝ 100๊ฐ์ ์ฑ ์๋ฒ์ ์ ์ํ์ฌ ์์ ํด์ผํ ๊ฒฝ์ฐ ๋งค๋ฒ SSH๋ก ์ ์ํด์ ์์ ํ๊ธฐ ํ๋ค๋ค. ์ด ๋ Ansible์ ์ฌ์ฉํ๋ฉด ํ๋ฒ๋ง ์คํํ์ฌ ๋ชจ๋ ์์ ์ ๋๋ผ ์ ์๋ค.
1
2
3
4
5
- hosts: app_servers
tasks:
- name: Create user
user:
name: ravi
์ ์คํํ ๊ฒฝ์ฐ
1
2
3
4
5
stapp01 โ ravi ์์ฑ
stapp02 โ ravi ์์ฑ
stapp03 โ ravi ์์ฑ
...
100๋ ๋ชจ๋ ์ ์ฉ
Day9 - MariaDB Troubleshooting
Problem
There is a critical issue going on with the
Nautilusapplication inStratos DC. The production support team identified that the application is unable to connect to the database. After digging into the issue, the team found that mariadb service is down on the database server.Look into the issue and fix the same.
Explanation
๊ฐ๋จํ๋ค mariadb๊ฐ ๋ค์ด๋์ด ์ค๋ฅ๊ฐ ๋๋ ๊ณ ์น๋ผ๋ ๊ฒ์ด๋ค. DB์๋ฒ๋ก ์ ์ํด์ ๋ค์ start์ํค๋ฉด ๋๋ค.
Answer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$ ssh peter@stdb01
$ systemctl status mariadb
โ mariadb.service - MariaDB 10.5 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; pre>
Active: inactive (dead)
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
$ sudo systemctl start mariadb
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xeu mariadb.service" for details.
$ sudo systemctl status mariadb -l
ร mariadb.service - MariaDB 10.5 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; pre>
Active: failed (Result: exit-code) since Wed 2026-06-17 14:41:33 UTC; >
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 21873 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exi>
Process: 21895 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb>
CPU: 88ms
Jun 17 14:41:33 stdb01 mariadb-prepare-db-dir[21983]: chown: changing owner>
Jun 17 14:41:33 stdb01 mariadb-prepare-db-dir[21958]: Cannot change ownersh>
Jun 17 14:41:33 stdb01 mariadb-prepare-db-dir[21958]: user. Check that you>
Jun 17 14:41:33 stdb01 mariadb-prepare-db-dir[21895]: Initialization of Mar>
Jun 17 14:41:33 stdb01 mariadb-prepare-db-dir[21895]: Perhaps /etc/my.cnf i>
Jun 17 14:41:33 stdb01 mariadb-prepare-db-dir[21895]: Initialization of Mar>
Jun 17 14:41:33 stdb01 mariadb-prepare-db-dir[21895]: Files created so far >
Jun 17 14:41:33 stdb01 systemd[1]: mariadb.service: Control process exited,>
Jun 17 14:41:33 stdb01 systemd[1]: mariadb.service: Failed with result exi>
Jun 17 14:41:33 stdb01 systemd[1]: Failed to start MariaDB 10.5 database se>
# Cannot change ownership
# MariaDB๊ฐ ์ด๊ธฐํํ๋ฉด์ ๋ฐ์ดํฐ ๋๋ ํ ๋ฆฌ ์์ ์๋ฅผ mysql ๊ณ์ ์ผ๋ก ๋ฐ๊พธ๋ ค๋๋ฐ ์คํจํ ์ํ
# ๋ณดํต /var/lib/mysql ๊ถํ/์์ ์๊ฐ ์๋ชป๋์ด ์์ ๋ ๋ง์ด ๋๋ค.
$ sudo chown -R mysql:mysql /var/lib/mysql
$ sudo systemctl start mariadb
โ mariadb.service - MariaDB 10.5 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; pre>
Active: active (running) since Wed 2026-06-17 14:45:32 UTC; 31s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 23022 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exi>
Process: 23044 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb>
Process: 23184 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=e>
Main PID: 23164 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 13 (limit: 404677)
Memory: 68.7M
CPU: 306ms
CGroup: /system.slice/mariadb.service
โโ23164 /usr/libexec/mariadbd --basedir=/usr
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: The second is mysql@l>
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: you need to be the sy>
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: After connecting you >
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: able to connect as an>
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: See the MariaDB Knowl>
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: Please report any pro>
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: The latest informatio>
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: Consider joining Mari>
Jun 17 14:45:32 stdb01 mariadb-prepare-db-dir[23107]: https://mariadb.org/g>
Jun 17 14:45:32 stdb01 systemd[1]: Started MariaDB 10.5 database server.
Day10 - Linux Bash Scripts
Problem
The production support team of
xFusionCorp Industriesis working on developing some bash scripts to automate different day to day tasks. One is to create a bash script for archiving website content files. They have a static website running onApp Server 2inStratos Datacenter, and they need to create a bash script namedbeta_archive.shwhich should accomplish the following tasks. (Also remember to place the script under the/scriptsdirectory onApp Server 2).a. Create a zip archive named
xfusioncorp_beta.zipof/var/www/html/betadirectory.b. Save the archive in the
/archives/directory on theApp Server 2. This is a temporary storage, as archives from this location will be cleaned on a weekly basis. Therefore, the archive should also be copied to theNautilus Storage Serverso it can be retrieved later for validation purposes.c. Copy the created archive to the
Nautilus Storage Serverserver in the/archives/location.d. Please make sure script wonโt ask for password while copying the archive file. Additionally, the respective server user (for example,
tonyin case ofApp Server 1) must be able to run it.e. Do not use sudo inside the script.
Note: The zip package must be installed on given App Server before executing the script. This package is essential for creating the zip archive of the website files. Install it manually outside the script.
Explanation
๋ฌธ์ ๋ ๊ธธ์ง๋ง ํต์ฌ ๋ด์ฉ์ App Server 2์์ /var/www/html/beta๋ฅผ zip์ผ๋ก ์์ถํ๊ณ , ๊ทธ zip ํ์ผ์ ๋ก์ปฌ /archives/์ Storage Server /archives/์ ์ ์ฅํ๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ค๋ผ๋ ๊ฒ์ด๋ค.
Answer
1
2
3
4
$ ssh steve@stapp02
$ sudo yum install -y zip
$ sudo vi /scripts/beta_archive.sh
beta_archive.sh ๋ด์ฉ
1
2
3
4
5
6
7
#!/bin/bash
cd /var/www/html || exit 1
zip -r /archives/xfusioncorp_beta.zip beta
scp /archives/xfusioncorp_beta.zip natasha@ststor01:/archives/
1
2
3
4
$ sudo chmod +x /scripts/beta_archive.sh
$ ssh-keygen
$ ssh-copy-id natasha@ststor01
Day11 - Install and Configure Tomcat Server
Problem
The
Nautilusapplication development team recently finished the beta version of one of their Java-based applications, which they are planning to deploy on one of the app servers inStratos DC. After an internal team meeting, they have decided to use thetomcatapplication server. Based on the requirements mentioned below complete the task:
a. Install tomcat server on App Server 3.
b. Configure it to run on port 6100.
c. There is a ROOT.war file on Jump host at location /tmp.
Deploy it on this tomcat server and make sure the webpage works directly on base URL i.e curl http://stapp03:6100
Explanation
App Server 3์ Tomcat ์ค์นํ์ฌ Tomcat ํฌํธ๋ฅผ 6100์ผ๋ก ๋ณ๊ฒฝ ํ Jump host์ /tmp/ROOT.war๋ฅผ App Server 3 Tomcat์ ๋ฐฐํฌํ์ฌ http://stapp03:6100 ์ผ๋ก ๋ฐ๋ก ์ ์๋๊ฒ ๋ง๋ค๋ฉด ๋๋ค.
์ถ๊ฐ๋ก curl http://stapp03:6100 ๋ช
๋ น์ด ๋์ํ๋ ์ด์ ๋ Jump Host์ App Server 3๊ฐ ๋์ผํ ๋ด๋ถ ๋คํธ์ํฌ(Stratos Datacenter)์ ์ฐ๊ฒฐ๋์ด ์๊ธฐ ๋๋ฌธ์ด๋ค.
Tomcat์ App Server 3์ 6100 ํฌํธ์์ HTTP ์์ฒญ์ ์์ (Listen)ํ๊ณ ์์ผ๋ฉฐ, Jump Host๋ ํด๋น ํฌํธ๋ก HTTP ์์ฒญ์ ๋ณด๋ผ ์ ์๋ค.
์ฆ, Jump Host์์:
1
curl http://stapp03:6100
๋ฅผ ์คํํ๋ฉด ๋ด๋ถ์ ์ผ๋ก App Server 3์ 6100 ํฌํธ๋ก HTTP ์์ฒญ์ด ์ ์ก๋๊ณ , Tomcat์ด ๋ฐฐํฌ๋ ROOT.war ์ ํ๋ฆฌ์ผ์ด์
์ ์๋ต์ ๋ฐํํ๊ฒ ๋๋ค.
๋ํ Tomcat์ webapps ๋๋ ํ ๋ฆฌ์ ROOT.war๋ฅผ ๋ฐฐํฌํ๊ธฐ ๋๋ฌธ์ ๋ณ๋์ Context Path ์์ด Base URL(/)๋ก ์ ๊ทผํ ์ ์๋ค.
Answer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$ scp /tmp/ROOT.war banner@stapp03:/tmp/
$ ssh banner@stapp03
$ sudo yum install -y tomcat
$ sudo vi /etc/tomcat/server.xml
# <Connector port="6100" protocol="HTTP/1.1"๋ก ๋ณ๊ฒฝ 8080 -> 6100
$ sudo cp /tmp/ROOT.war /var/lib/tomcat/webapps/
$ sudo systemctl enable tomcat
$ sudo systemctl restart tomcat
#ํ์ธ
$ curl http://stapp03:6100
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>SampleWebApp</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h2>Welcome to xFusionCorp Industries!</h2>
<br>
</body>
</html>