-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
449 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# B612 DevOps Track Common License | ||
|
||
This repository is made available publicly; however, all copyrights belong to the creators of the works contained within. No person is permitted to modify these works without explicit consent from the original copyright holder. | ||
|
||
Individual documents within this repository are the property of their respective creators. However, the repository itself is owned by B612. B612 reserves the right to delete any document within this repository but does not retain the right to modify any document. | ||
|
||
All documents within this repository may be exposed externally under notice. They may be made public for the benefit of B612, its participants, or external support organizations such as Naver Cloud Platform. Individual licenses cannot refuse this condition. | ||
|
||
Contributors who contribute to this repository may set their own license policy for the documents they contribute. In order for a contributor's license policy to take effect, the contributor must include a file named LICENSE or LICENSE.md (case-insensitive) within their directory or specify their license at the top of their individual documents. | ||
|
||
A contributor's license does not extend to documents outside of their directory and does not compel others to make their code open source. In other words, a contributor's license cannot affect to others or enforce obligations akin to those of licenses such as the GPL on other contributors. | ||
|
||
## Disclaimer of Warranty | ||
Unless required by applicable law or agreed to in writing, the documents provided in the repository are provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the documents and assume any risks associated with your exercise of permissions under this License. | ||
|
||
It is important to remember that the aforementioned terms apply only to the documents contributed by each respective contributor within their own directory, and not to the repository as a whole. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# linux-WIL | ||
리눅스 실습 과제 제출용 레포지토리 | ||
|
||
## Assignments | ||
각자 자신의 이름(혹은 github 닉네임)으로 된 디렉토리를 만들어서, 그 안에 실습 내용을 md 형식으로 작성해서 PR을 보내주세요. | ||
|
||
폴더 구조는 아래와 같은데, 본인 폴더만 만드신다면 그 내부 구조는 어떻게 되든 괜찮습니다. | ||
|
||
## Folder Structure | ||
``` | ||
├── README.md | ||
├── LICENSE | ||
├── username | ||
│ ├── README.md | ||
│ ├── apache | ||
│ │ ├── apache.md | ||
│ │ └── ... | ||
│ └── shellscript | ||
│ │ ├── shellscript.md | ||
│ │ └── ... | ||
├── myuser | ||
│ ├── README.md | ||
│ ├── apache | ||
│ └── shellscript | ||
└── ... | ||
``` | ||
|
||
## License | ||
This repository is licensed under the B612 Custom DevOps license. See the [LICENSE](LICENSE.md) file for details. By following the rules of the license, you are allowed to set your custom license for your own directory, but not with the license those who affect the whole repository or others' creations. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# 과제 1 : 웹 서버(Apache)를 리눅스에 설치해보자! | ||
|
||
## 1. 서버 ip 주소 알아내기 | ||
- 컴퓨터에 부여된 실제 ip 주소 출력 ⇒ 192.168.91.128 | ||
|
||
 | ||
|
||
- 컴퓨터가 외부에 접속할 때 사용하는 ip 주소 출력 ⇒ 39.115.197.35 | ||
|
||
 | ||
|
||
## 2. 서버 컴퓨터에 웹 서버 설치하기 | ||
|
||
 | ||
|
||
 | ||
|
||
 | ||
|
||
 | ||
|
||
 | ||
|
||
## 3. 웹 서버 설치 여부 확인하기 | ||
- 버전 확인 | ||
|
||
 | ||
|
||
- status 확인 | ||
|
||
 | ||
|
||
## 4. 웹 서버 실행/중지/재시작 해보기 | ||
|
||
 | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
carlsen, password1234 | ||
najdorf, thisispassword | ||
morphy, abcd1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
FILE="users.csv" | ||
|
||
while IFS="," read -r username password; do | ||
if id -u "${username}" >/dev/null 2>&1; then | ||
echo "'${username}'는 이미 존재하는 사용자입니다." | ||
exit | ||
fi | ||
useradd "${username}" | ||
echo "${username}:${password}" | chpasswd | ||
echo "${username}는 사용자로 등록되었습니다." | ||
done < "${FILE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 실습 1. Apache 서버 실행 | ||
|
||
--- | ||
|
||
## 1. 서버 ip주소 알아내기 | ||
|
||
 | ||
|
||
## 2. 웹서버 설치하기 | ||
|
||
 | ||
|
||
 | ||
|
||
## 3. 웹 서버 설치 여부 확인하기 | ||
|
||
 | ||
|
||
 | ||
|
||
## 4. 웹 서버 실행/중지/재시작 해보기 | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# 과제 1 | ||
|
||
### 1. **서버 ip 주소 알아내기** | ||
|
||
**1) 컴퓨터에 부여된 실제 ip** | ||
|
||
<img width="602" alt="아파치1" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/76800c13-8d74-4445-b4a7-4447c355d29d"> | ||
|
||
ip라는 명령어가 사용되지 않는다 | ||
|
||
`iproute2`라는 패키지를 설치하면 사용할 수 있다고 한다 | ||
|
||
`iproute2`라는 패키지는 리눅스에서 네트워크 관련 작업를 수행하는 역할을 한다 | ||
|
||
```bash | ||
arch -arm64 /bin/bash | ||
brew install iproute2mac | ||
``` | ||
|
||
그래서 homebrew를 이용해 iproute2mac 패키지를 설치해 주었다 | ||
|
||
zsh에서 바로 설치하려고 하니까 | ||
|
||
```bash | ||
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)! | ||
To rerun under ARM use: | ||
arch -arm64 brew install ... | ||
To install under x86_64, install Homebrew into /usr/local | ||
``` | ||
|
||
이런 에러가 떠서… ARM 아키텍처로 터미널을 실행한 뒤 설치해 주었다 | ||
|
||
<img width="602" alt="아파치2" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/09cd356f-cc7b-41f9-a9f0-6009afdd33ed"> | ||
|
||
<img width="602" alt="아파치3" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/b9e825e7-7df5-4c7e-a647-d35a51bd4f3d"> | ||
|
||
192.168.0.111 | ||
|
||
**2) 컴퓨터가 외부에 접속할 때 사용하는 ip 주소** | ||
|
||
<img width="602" alt="아파치4" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/e23a943a-0204-4265-bd65-f338faaaecbb"> | ||
|
||
110.11.254.155 | ||
|
||
### 2. 서버 컴퓨터에 웹 서버 설치하기 | ||
|
||
Hombrew를 사용해 Apache를 설치했다. | ||
|
||
```bash | ||
brew update | ||
brew install httpd | ||
``` | ||
|
||
<img width="602" alt="아파치5" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/686ac2e6-73f3-49c7-85ab-d2246e4f1981"> | ||
|
||
### 3. 웹 서버 설치 여부 확인하기(2가지 방법 모두) | ||
|
||
**1) 버전 확인** | ||
|
||
```bash | ||
httpd -v | ||
``` | ||
|
||
<img width="265" alt="아파치6" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/ce05d0d3-515c-438a-a15a-b23edcac32ec"> | ||
|
||
**2) status 확인** | ||
|
||
```bash | ||
brew services list | ||
``` | ||
|
||
macOS에서는 systemd를 사용하지 않아 위 명령어를 사용해 Homebrew로 설치한 서비스 목록을 확인했다. | ||
|
||
<img width="275" alt="아파치7" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/8e8e7460-e3c5-4ea9-9693-5b69aeb18ddd"> | ||
|
||
### 4. 웹 서버 실행/중지/재시작 해보기 | ||
|
||
```bash | ||
brew services start httpd | ||
brew services stop httpd | ||
brew services restart httpd | ||
``` | ||
|
||
**1) 실행** | ||
|
||
<img width="602" alt="아파치8" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/0414cfb8-c11b-4490-b1ed-b4bd3f8921bf"> | ||
|
||
<img width="1256" alt="아피치9" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/563b4dd9-dff1-4449-8a28-3136a2969a99"> | ||
|
||
**2) 중지** | ||
|
||
<img width="602" alt="아파치10" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/5f0e3baa-f67e-47e6-92d2-1222f5a53274"> | ||
|
||
<img width="1256" alt="아파치11" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/71546344-5e5f-4800-a436-395217510770"> | ||
|
||
**3) 재시작** | ||
|
||
<img width="602" alt="아파치12" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/f783b899-ca36-42d9-99e8-c762f43e03ad"> | ||
|
||
<img width="1256" alt="아파치13" src="https://github.com/b612-devops-track/linux-WIL/assets/103591752/7be9514e-b38e-4d03-957b-323e75bc22b9"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
carlsen, password1234 | ||
najdorf, thisispassword | ||
morphy, abcd1234 | ||
nayeon, 0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
users_file="./users.csv" | ||
|
||
username="nayeon" | ||
password="0000" | ||
|
||
|
||
if ! grep -q "$username" "$users_file"; then | ||
echo "$username, $password" >> "$users_file" | ||
echo "사용자를 추가했습니다" | ||
else | ||
echo "이미 존재하는 사용자입니다" | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# 과제1 | ||
|
||
## 1. 서버 ip 주소 알아내기 | ||
<img width="782" alt="스크린샷 2023-06-17 오전 11 51 59" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/aa2f118f-ada7-4cc9-89ce-d7cbcd867638"> | ||
|
||
|
||
`ip addr` 명령어를 사용하니 오류가 발생한다. 그래서 `iproute2mac`을 설치해줬다. | ||
|
||
<br> | ||
|
||
> brew install iproute2mac | ||
|
||
<img width="782" alt="스크린샷 2023-06-17 오후 12 19 46" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/dbe0bbca-5feb-4372-ba77-b8d4e1fba000"> | ||
|
||
이제 명령어가 잘 실행되는 것을 확인할 수 있다. | ||
|
||
|
||
### 컴퓨터에 부여된 실제 ip | ||
|
||
<img width="670" alt="스크린샷 2023-06-17 오후 12 26 54" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/6af46a13-071d-48e4-9d09-e22834fb4eab"> | ||
|
||
|
||
### 컴퓨터가 외부에 접속할 때 사용하는 ip | ||
|
||
<img width="668" alt="스크린샷 2023-06-17 오후 12 32 35" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/cae2ce8a-fb7e-428a-900b-5c8a0099ee21"> | ||
|
||
|
||
## 2. 서버 컴퓨터에 웹 서버 설치하기 | ||
|
||
> brew install httpd | ||
<br> | ||
위의 명령어를 이용하여 웹 서버를 설치한다. | ||
|
||
|
||
<img width="782" alt="스크린샷 2023-06-17 오후 12 40 26" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/c479faf7-2dd2-425f-a137-bb9b88d0cba1"> | ||
|
||
### 버전확인 | ||
> httpd -v | ||
> apachectl -v | ||
<br> | ||
|
||
위의 명령어로 버전을 확인하면 다음과 같은 결과가 나온다. | ||
|
||
<br> | ||
|
||
<img width="671" alt="스크린샷 2023-06-17 오후 12 46 56" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/a337a1cc-bd7a-49ea-a746-0d2ac2b5845b"> | ||
|
||
### 웹 서버 실행 | ||
|
||
> brew services start httpd | ||
<br> | ||
|
||
<img width="1440" alt="스크린샷 2023-06-17 오후 12 50 28" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/10273446-a9fb-4164-995f-7e5dd0475abf"> | ||
|
||
|
||
### 웹 서버 중단 | ||
|
||
> brew services stop httpd | ||
<br> | ||
|
||
<img width="1440" alt="스크린샷 2023-06-17 오후 12 51 10" src="https://github.com/leeedohyun/linux-WIL/assets/116694226/4f1164d2-07b8-4253-a9bb-67e5bb955a01"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
file="users.csv" | ||
|
||
while IFS=: read -r username password; | ||
do | ||
if id - u "$username" >/dev/null 2>&1; then | ||
echo "유저 '$username'이 이미 존재합니다." | ||
else | ||
sudo useradd $username | ||
echo "$username:$password" | sudo chapasswd | ||
echo "'$username'이 등록되었습니다." | ||
fi | ||
done < "$file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## 실습 결과 | ||
|
||
 | ||
|
||
|
||
|
||
## 실습 쉘 | ||
|
||
```bash | ||
$ apachectl -v | ||
Server version: Apache/2.4.57 (Unix) | ||
Server built: Apr 6 2023 18:16:37 | ||
|
||
$ apachectl start | ||
|
||
$ apachectl stop | ||
``` | ||
|
||
혹은 brew services를 이용할 수도 있음 | ||
|
||
```bash | ||
$ brew services start httpd | ||
$ brew services info httpd | ||
$ brew services stop httpd | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
# CSV file name | ||
FILE="users.csv" | ||
|
||
# Read the CSV file | ||
while IFS="," read -r username password | ||
do | ||
# Check if the user already exists | ||
if id -u "${username}" >/dev/null 2>&1; then | ||
echo "User ${username} already exists. Skipping..." | ||
else | ||
# If the user does not exist, create the user and set the password | ||
useradd "${username}" | ||
echo "${username}:${password}" | chpasswd | ||
echo "User ${username} has been created." | ||
fi | ||
done < "${FILE}" |
Oops, something went wrong.