Skip to content
This repository was archived by the owner on Feb 25, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions GSHS_SERVER_INTRO_2/LICENSE

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions GSHS_SERVER_INTRO_2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# GSHS-Linux-Intro
서버를 처음 접하는 연구자를 위한 리눅스 기반 서버 사용 설명서입니다.

경기과학고등학교 리눅스 사용자협회와 서버관리 봉사동아리 GM에 의해 관리되고 있습니다.

LaTeX로 작성되어 있으며 [오버리프 링크](https://www.overleaf.com/read/dyfnsffzsnvq)에서 볼 수 있습니다.

![image](https://user-images.githubusercontent.com/48399106/128599886-d168cbce-c34b-42d1-a424-b8c9cdef77f2.png)
![image](https://user-images.githubusercontent.com/48399106/128599925-ed93e668-faa4-4d09-8811-ab6d27ab6653.png)
18 changes: 18 additions & 0 deletions GSHS_SERVER_INTRO_2/appA/appendix_a_main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
\chapter{Troubleshooting}
\section{Graphic Driver}
\subsection{nvidia-smi}
nvidia driver labrary mismatch~\\

cuda
\section{Storage}
dev1
\section{Python Environments}
pip, pip3, venv
\section{Jupyter}
config
\section{SSH}
sshd\_config
\section{Database}
mongodb, mariadb
\section{Nginx}
nginx.conf
10 changes: 10 additions & 0 deletions GSHS_SERVER_INTRO_2/appB/appendix_b_main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
\chapter{GSHS CSLAB}
정보과 연구용 기기 목록
\begin{itemize}
\item Nvidia RTX 2070 eGPU $\times$ 2
\item Nvidia RTX 2080 Super eGPU $\times$ 1
\item Nvidia RTC 3070 $\times$ 1
\item Intel NUC $\times$ 2
\item 메인 서버.
\item 구서버 (테스트용 서버)
\end{itemize}
7 changes: 7 additions & 0 deletions GSHS_SERVER_INTRO_2/appC/appendix_c_main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

\chapter{Contributors}

37st (Version1) : 19007 권준우, 19011 김도영, 19032 노현서, 19042 박영민


38st (Version2) : 20059 송혁중
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions GSHS_SERVER_INTRO_2/chap1/introduction_main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
\chapter{Introduction}

\graphicspath{{./chap1/images/}}
\textbf{서버는 모두가 함께 사용하는 것입니다.}

\section{Motivation}
경기과학고등학교(\acs{GSHS})에는 고성능 \acs{GPU} 6개, 그리고 40개의 \acs{CPU} 코어를 가진 서버가 있다. 이 서버는 강력하기에 학생들은 자신의 연구에 큰 도움을 받고 있다. 그러나, 그 서버의 무분별한 사용과 관리자 부재로 인해 연구활동에 어려움을 겪게 되었으며 신입생들의 경우 구전으로 전해지는 사용 방법에 의존해야 했다. 이에 문제의식을 느낀 37기 정보과 일동은 경기과학고등학교 리눅스 사용자 협회, 그리고 교내 봉사모둠인 GM을 만들어 서버 사용 및 관리를 체계화하는 한편 본 설명서를 통해 처음 서버를 이용하는 학생들을 돕고자 한다.

\section{Ubuntu}
Ubuntu Linux는 윈도우와 같은 운영체제로, 윈도우와 달리 무료이며 공개 소스이다. 서버에 일반적으로 이용하는 Ubuntu Server는 \acs{GUI}가 없는 Ubuntu로, 마우스 없이 명령줄만으로 제어하는 \acs{CLI} 환경이다. 윈도우의 명령 프롬프트(cmd)와 유사하다.

%\subsection{Showing the Use of Acronyms}

%In the early nineties, \acs{GSM} was deployed in many European countries. \ac{GSM} offered for the first time international roaming for mobile subscribers. The \acs{GSM}’s use of \ac{TDMA} as its communication standard was debated at length. And every now and then there are big discussion whether \ac{CDMA} should have been chosen over \ac{TDMA}.

%If you want to know more about \acf{GSM}, \acf{TDMA}, \acf{CDMA} and other acronyms, just read a book about mobile communication. Just to mention it: There is another \ac{UA}, for testing.
59 changes: 59 additions & 0 deletions GSHS_SERVER_INTRO_2/chap2/connection_main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

\graphicspath{{./chap2/images/}}
\chapter{Connection}

\textbf{이 장은 서버와의 연결, 그리고 파일 송수신 방법을 다룬다.}

\section{SSH를 이용한 서버 접속}
서버는 학교에 있으므로 원격으로만 이용할 수 있다. 이를 위하여 SSH(Secure SHell)를 쓴다. Putty와 같은 전용 프로그램을 이용해도 되고, OpenSSH를 설치한 후 명령 프롬프트와 같은 환경에서 SSH 명령어를 이용해도 된다. 이 문서에서는 후자를, Windows 10 기준으로 설명하도록 하겠다.\\

먼저 윈도우에서 시작 > 설정 > 앱 > 앱 및 기능에 들어간다.
\begin{figure}[h]
\begin{center}
\includegraphics[width=5cm]{ssh1.png}
\caption{앱 및 기능}
\end{center}
\end{figure}

여기서 선택적 기능을 클릭하고 SSH를 검색해 OpenSSH를 찾아 설치한다.

\begin{figure}[H]
\begin{center}
\includegraphics[width=4cm]{ssh2.png}
\includegraphics[width=4cm]{ssh3.png}
\caption{OpenSSH 서버 설치}
\end{center}
\end{figure}


경기과학고등학교 연구용 서버는 Ubuntu 18.04로 구성되어 있다. 이 운영체제는 Windows처럼 사용자 이름(username)과 암호(password)가 있어야 한다. 만약 본인이 서버를 이용하고 싶다면 근처의 정보전공 친구에게 사이다를 사주고 계정을 얻어내도록 하자. 일련의 과정을 통해 서버에 접속할 계정명과 암호, 주소와 포트까지 알게 되었다면 다음과 같은 명령어를 통해 서버에 접속할 수 있다. 이후 암호를 입력하면 접속에 성공한 것이다. 참고로 root 계정은 보통 이용하지 않는다.\\
\begin{lstlisting}
$ ssh -p [port] [username]@[address]
ex) ssh -p 22 root@127.0.0.1
\end{lstlisting}


로그인하면 다음과 같은 화면을 볼 수 있다. 참고로 서버는 TUI 환경이기에 접속된 창으로 모든 작업을 수행하게 된다.
\begin{figure}[H]
\begin{center}
\includegraphics[width=7cm]{ssh5.png}
\caption{SSH 접속창}
\end{center}
\end{figure}

\section{SFTP를 이용한 파일 관리}
SFTP는 SSH File Transfer Protocol의 약어다. 즉, 이미 다룬 SSH 통신을 이용해 파일을 전송하는 것이다. 대표적인 프로그램으로 \href{https://filezilla-project.org/}{FileZilla}가 있다. 파일질라를 설치한 후 좌측 상단 사이트 관리자에서 새 로그인 정보를 만들어 저장하고 연결하면 된다.
\begin{figure}[H]
\begin{center}
\includegraphics[width=8cm]{sftp2.png}
\caption{FileZilla 접속}
\end{center}
\end{figure}
접속에 성공하면 화면 양쪽에 파일 탐색기가 생길 것이다. 좌측은 현재 사용자의 컴퓨터이며 우측은 서버다. 이제 사용자는 평소 윈도우 파일 탐색기를 이용하듯 파일을 끌어 옮기거나 다운로드하여 편집할 수 있다. 다만 파일을 다운로드 후 편집하고 다시 업로드를 해야 서버의 파일이 수정된다는 점에 유의해야 한다.
\begin{figure}[H]
\begin{center}
\includegraphics[width=8cm]{sftp3.png}
\caption{파일질라 접속}
\end{center}
\end{figure}

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.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/sftp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/sftp2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/sftp3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/ssh1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/ssh2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/ssh3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/ssh4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GSHS_SERVER_INTRO_2/chap2/images/ssh5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
183 changes: 183 additions & 0 deletions GSHS_SERVER_INTRO_2/chap3/command_main.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@

\graphicspath{{./chap3/images/}}
\chapter{Command}
\textbf{이 장은 기본 리눅스 명령어를 다룬다.}
\section{파일 관리}
\subsection{절대경로와 상대경로}
절대경로는 /home/gs19000/dir1/dir2와 같은 것이다. 상대경로는 현재 내 위치에서 시작하는 경로다. 즉, 내가 지금 /home/gs19000/dir1에 있다면 여기서 /home/gs19000/dir1/dir2의 상대경로는 그냥 dir2다.
\subsection{디렉토리 및 탐색}
cd 명령어를 사용해서 디렉터리를 탐색할 수 있다. \\ ..은 상위 디렉토리, -은 이전 디렉토리, $\sim$는 홈 디렉토리를 의미한다.
cd (디렉토리)라 치면 해당 디렉토리로 이동된다. 디렉토리를 표현할 때 절대경로, 상대경로 둘 다 가능하며, 실행시 주소쪽 값이 변경된다.
\begin{lstlisting}
$ cd dir1 입력시
~/dir1$ __으로 바뀐다.
$ cd /home/gs19000/dir1
$ cd ..
$ cd -
$ cd ~
\end{lstlisting}
\subsection{디렉토리 및 파일 관리}
rm 명령어를 사용해서 파일을 삭제할 수 있다.\\
rm (file) : 해당 파일을 삭제한다. rm -r (dir) : 해당 디렉토리를 삭제한다.
또한, mkdir 명령어를 사용해서 디렉터리를 만들 수 있다.\\
mkdir (dir) : 해당 이름의 디렉토리가 존재하지 않을 경우 새로 dir이름의 디렉터리를 생성한다.\\


다음으로 cp, mv 명령어를 통해 파일을 옯기거나 복사할 수 있다.\\
cp (file1) (file2) : file1의 이름을 file2 이름으로 바꾸어 복사한다.(file1은 삭제되지 않음 file2가 이미 존재할 경우 덮어씌워진다)\\
cp -r (dir1) (dir2) : dir1이름의 디렉토리를 dir2 디렉토리 내부에 복사한다.(dir1은 반드시 존재해야 하며 dir2는 존재하지 않을 경우 새로 만들어진다)\\
mv (file1) (file2) : file1의 이름을 file2로 바꾼다.(file2가 이미 존재할 경우 덮어씌워진다)\\
mv (dir1) (dir2) : dir1의 이름을 dir2로 바꾼다.(dir1은 반드시 존재해야 하며 dir2가 존재할 경우 dir2 내부에 dir1 파일을 이동시킨다.)\\
마지막으로, cat을 이용해 내용을 읽어올 수 있다. cat (file1) : file1의 내용을 불러온다.
\begin{lstlisting}
$ rm file1
$ rm -r dir1
$ mkdir dir2
$ cp file1 file2
$ cp -r dir1 dir2
$ mv file1 file2
$ mv dir1 dir2
$ cat file3.txt
\end{lstlisting}
\section{기타 기능}
\subsection{프로세스 관리}
htop을 이용해 실행중인 프로세스를 확인할 수 있다. kill, pkill을 통해 프로세스를 제거할 수 있다.
\begin{lstlisting}
$ htop
$ kill -9 <pid>
\end{lstlisting}
\subsection{권한 관리}
chmod를 이용해 권한을 관리할 수 있다. 권한에 대한 자세한 정보는 ...
\begin{lstlisting}
$ sudo chmod 777 file1
\end{lstlisting}
\subsection{Vim}
기본 메모장과 같다. 우분투 서버를 지속적으로 다룰 생각이 있다면 Vim 에디터에 익숙해질 필요가 있다. 먼저, vim 에디터를 사용하여 파일을 수정하기 위해서는 vim 에디터를 실행해야 한다. vim 에디터는 다음과 같은 명령어를 통해 실행할 수 있다.
\begin{lstlisting}
$ vim filename
\end{lstlisting}
위와 같이 vim 에디터를 통해 파일을 열게 되면 다음과 같은 화면이 나타난다.

\begin{figure}[H]
\begin{center}
\includegraphics[width=0.8\linewidth]{chap3/images/vim.png}
\caption{vim 에디터 실행 화면}
\end{center}
\end{figure}

그런데 이 상태에서 무언가를 입력하려 하면 아마 파일이 수정되지 않을 것이다.\\
왜냐하면 vim 에디터는 수정 모드가 아니라면 파일의 내용을 수정할 수 없기 때문이다.\\
vim 에디터에서 수정모드로 변환하는 방법은 간단하다. i를 입력하면 수정모드로 변환되며, 만약 수정모드를 다시 끄고 싶다면 ESC 키를 누르면 수정모드가 종료된다.\\
수정모드가 아닌 상태에서는 여러 가지 단축키와 커맨드를 통해 여러 기능을 사용할 수 있는데, 이 문서에서는 자주 사용하는 기능의 단축키만을 다룰 것이다. 아래 단축키들을 자주 사용하므로 미리 숙지해놓자.\\

\subsubsection{이동}
\paragraph{기본 이동}
\begin{itemize}[$\bullet$]
\item h,j,k,l : 좌,하,상,우 커서 이동
\item - : 줄의 처음 위치로 이동
\item gg : 맨 위로 커서 이동
\item Shift + g : 맨 아래로 커서 이동
\end{itemize}
\paragraph{단어 단위로 이동}
\begin{itemize}[$\bullet$]
\item w : 단어의 시작 위치로 커서 이동 (forward 방향)
\begin{itemize}[Ex)]
\item 3w : 세 단어 앞으로 커서 이동
\end{itemize}
\item e : 단어의 마지막 위치로 커서 이동 (forward 방향)
\item b : 단어의 시작 위치로 커서 이동 (backward 방향)
\item ge : 단어의 마지막 위치로 커서 이동 (backward 방향)
\end{itemize}
\paragraph{한 문장 내에서의 이동}
\begin{itemize}[$\bullet$]
\item \^ : 문장 맨 앞으로 커서 이동
\item \$ : 문장 맨 뒤로 커서 이동
\end{itemize}
\paragraph{대략적인 위치로 이동}
\begin{itemize}[$\bullet$]
\item Shift + h : 현재 보이는 페이지를 기준으로 맨 위로 커서 이동
\item Shift + m : 현재 보이는 페이지를 기준으로 중간 라인으로 커서 이동
\item Shift + l : 현재 보이는 페이지를 기준으로 가장 아래로 커서 이동
\end{itemize}
\paragraph{페이지 이동}
\begin{itemize}[$\bullet$]
\item Ctrl + f : 다음 페이지의 첫 줄로 커서 이동
\item Ctrl + b : 다음 페이지의 마지막 줄로 커서 이동
\item Ctrl + d : 페이지의 절반 크기만큼 아래로 커서 이동
\item Ctrl + u : 페이지의 절반 크기만큼 위로 커서 이동
\end{itemize}
\paragraph{원하는 줄 번호로 한번에 이동}
\begin{itemize}[$\bullet$]
\item :[number] : [number]행으로 이동
\begin{itemize}[Ex)]
\item :3 : 3번째 줄로 이동. 줄 번호는 1부터 시작한다.
\end{itemize}
\end{itemize}
\paragraph{\{\} 기준으로 이동}
\begin{itemize}[$\bullet$]
\item ]] : \{로 커서 이동 (forward 방향)
\begin{itemize}[$\circ$]
\item 없으면 페이지의 맨 아래로 커서 이동
\item \{은 가장 상위의 블록을 감싸고 있는 문자만 찾는다.
\end{itemize}
\item[$\bullet$] [[ : \{로 커서 이동 (backward 방향)
\item ][ : \}로 커서 이동 (forward 방향)
\begin{itemize}[$\circ$]
\item 없으면 페이지의 맨 아래로 커서 이동
\item \}은 가장 상위의 블록을 감싸고 있는 문자만 찾는다.
\end{itemize}
\item[$\bullet$] [] : \}로 커서 이동 (backward 방향)
\item \% : \{\}나 ()에서 현재 괄호의 짝으로 커서 이동
\end{itemize}

\subsubsection{편집}
\paragraph{삽입 관련 단축키}
\begin{itemize}[$\bullet$]
\item i : 현재 커서가 위치한 문자의 앞에 insert 하기
\item I : 현재 커서가 위치한 줄 맨 앞에 insert 하기
\item a : 현재 커서가 위치한 문자의 뒤에 insert 하기
\item A : 현재 커서가 위치한 줄 맨 뒤에 insert 하기
\item O : 현재 커서가 위치한 줄 바로 윗줄에 insert 하기
\item o : 현재 커서가 위치한 줄 바로 아랫줄에 insert 하기
\end{itemize}
\paragraph{삭제/잘라내기 및 수정 관련 단축키}
\begin{itemize}[$\bullet$]
\item dd : 커서가 위치한 줄 잘라내기
\item dw : 커서가 위치한 곳부터 단어의 마지막까지 잘라내기
\item Shift + d : 커서가 위치한 곳부터 줄의 끝까지 잘라내기
\item x : 커서가 위치한 문자 잘라내기
\item Shift + x : 커서가 위치한 문자 바로 앞에 있는 문자 잘라내기
\item s : 커서가 위치한 문자 잘라내고 insert 하기
\item cc 또는 Shift + s : 커서가 위치한 줄 전체 잘라내고 insert 하기
\item cw : 커서가 위치한 곳부터 단어의 마지막까지 잘라내고 insert 하기
\item Shift + c : 현재 커서의 위치부터 줄의 끝까지 잘라내고 insert 하기
\item r + [변경할 문자] : 커서가 위치한 문자 하나 수정하기
\begin{itemize}[Ex)]
\item 4rx : 현재 커서 이후 4개의 글자를 x로 수정한다.
\end{itemize}
\end{itemize}
\paragraph{복사/붙여넣기 관련 단축키}
\begin{itemize}[$\bullet$]
\item yl : 현재 커서가 위치한 문자 하나만 복사하기
\begin{itemize}[Ex)]
\item 3yl : 현재 커서 이후 3개의 문자를 복사한다.
\end{itemize}
\item yy : 현재 커서가 위치한 줄 복사하기
\item yw : 현재 커서의 위치부터 단어가 끝나는 위치까지 복사하기
\item y : 블럭 단위로 체크한 내용(비주얼 모드 이용) 복사하기 - 한 문자만 복사 X
\begin{itemize}[Ex)]
\item[Ex)] [number] + y : 커서가 위치한 줄부터 [number]만큼의 줄 복사하기
\item y\$ : 커서가 위치한 곳부터 줄의 마지막까지 복사하기
\end{itemize}
\item p : 복사한 것을 붙여넣기. 단어를 복사한 경우 커서가 위치한 곳에 붙여넣고, 행 단위를 복사한 경우 커서가 위치한 줄 다음 줄에 붙여넣는다.
\item Shift + p : 복사한 것을 앞에 붙여넣기. 단어를 복사한 경우 커서가 위치한 곳 앞에 붙여넣고, 행 단위를 복사한 경우 커서가 위치한 줄 바로 윗줄에 붙여넣는다.
\item[$\bullet$] [number] + p : [number] 만큼 붙여넣기를 반복.
\end{itemize}

이외에도 다양한 단축키가 있으니, 위 목록에 없는 단축키를 안다면 추후 추가 바람.

\subsection{Pipeline}
파이프라인을 통해 출력값에서 원하는 문자열을 확인할 수 있다. 보통 아래와 같이 |와 grep을 이용해 사용한다. 아래의 경우 file2.txt를 출력하는데, 그중 "abc"가 포함된 부분을 찾는 것이다.
\begin{lstlisting}
$ cat file2.txt | grep abc
\end{lstlisting}
Binary file added GSHS_SERVER_INTRO_2/chap3/images/vim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading