본문 바로가기

Study/Ubuntu 공부

[Ubuntu Linux] 최초 설치시 권장 패키지들 (SW 개발자 개발환경 기준)

반응형

Ubuntu Linux를 처음 설치했다면, 셋업 해줘야 하는 것들이 상당히 많이 있습니다. 여러분들이 만약 VMware를 이용하여 Virtual Machine으로 Ubuntu Linux를 돌린다면, VMware tool부터 설치해야 할 것이고, 여러분들이 만약 Software 개발자라면 Java, Eclipse, Docker, Git 등의 패키지를 설치해야 되겠지요. 

 

본 페이지에서는 Ubuntu Linux를 처음 설치했을 때, 추가로 설치하면 좋은 패키지들에 대해서 기록해두고자 합니다. 

이것은 저를 위한 기록이지만, 어쩌면 누군가에게 유용한 정보가 될 수 있기를 바라며 이 글을 작성합니다. 

 

[net-tools 패키지 설치]

Ubuntu Linux를 설치하고 가장 먼저 살펴보는 것이 바로 네트워크 설정일 것입니다. 머신에 할당된 IP를 확인하기 위해서는 ifconfig 명령을 수행해야 하겠지요. 최초 Ubuntu Linux를 설치하면 ifconfig 명령조차도 실행되지 못하면서 아래와 같은 에러 메시지가 표시됩니다.

$ ifconfig
Command 'ifconfig' not found, but can be installed with :
sudo apt install net-tools

 

친절하게도 ifconfig 명령을 찾을 수 없다고 하면서, net-tools 패키지를 설치하도록 가이드를 주네요.

쉘에서 가이드한 대로 아래의 명령으로 net-tools 패키지를 설치하면 ifconfig 명령을 수행할 수 있게 됩니다.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install net-tools

 

본 블로그를 운영하면서 항상 강종하는 것이지만, 패키지 설치 이전에 반드시 sudo apt-get update, sudo apt-get upgrade 명령을 관용적으로 미리 실행하는 게 좋습니다. Ubuntu Linux를 설치하고 최초로 위의 명령을 수행하거나, 오랫동안 수행하지 않았을 경우 상당히 오랜 시간이 소요될 수도 있습니다. 

 

 


 

[VMware tool 설치]

여러분들이 만약 실제 PC에 Ubuntu Linux를 설치했다면 본 과정을 생략하시기 바랍니다. 만약 VMware를 이용하여 Virtual Machine(가상 머신)으로 Ubuntu Linux를 설치하셨다면 VMware Tool을 설치하시기를 강력히 권장합니다. 

 

 

 


 

[git 설치]

여러분들이 만약 software 개발자라면 형상관리시스템으로 git을 사용하고 있을지도 모릅니다. 최초 Ubuntu 설치 시에는 당연히 git 패키지가 설치되어있지 않기 때문에 아래와 같은 에러 메시지가 발생하게 될 겁니다. git을 사용하는 소프트웨어 개발자라면 git 패키지를 설치하시기 바랍니다.

$ git
Command 'git' not found, but can be installed with:
sudo apt install git

 

참으로 친절한 에러메시지라고 할 수 있겠습니다. 쉘에서 알려준 것처럼 git 패키지를 설치하면 해결됩니다.

$ sudo apt-get install git

 

git clone을 통해서 git이 정상적으로 동작하는지 확인합니다.

$ git clone (URL)

 

매번 credential을 입력하기 귀찮으므로 아래와 같이 credential 관련된 내용들을 설정해줍니다.

$ git config --global --add user.email abc@abc.com
$ git-config --global --add user.name gil-dong-hong
$ git-config --global --add credential.helper=store

 

위와 같이 설정한 이후에 git clone과 같은 git 명령을 통해 username과 password를 입력하면 홈 디렉토리에 .git-credentials 라는 파일이 생성되고 그 안에 아래와 같은 형식으로 credentail 정보가 저장됩니다. 

$ cat ~/.git-credentials
https://{username}:{token}@{URL}

이 경우, .git-credentials 파일 권한은 600이라서 owner만 r/w가 가능하지만 root 권한을 가진 사용자는 credential을 볼 수 있는 취약점은 있습니다.

 

$ ls -all ~/.git-credentials 
-rw------- 1 {user} {group} 100  2월  2 09:46 /home/{user}/.git-credentials

 

github 설정이 필요하다면 아래와 같이 깃 헙 설정도 추가해줍니다.

$ git-config --global --add hub.host (URL)

 

홈 디렉토리의 .git config 파일을 열어보면 설정된 값을 확인할 수 있습니다. 

$ cat ~/.gitconfig 
[user]
	email = abc@abc.com
	name = gil-dong-hong
[credential]
	helper = store
[hub]
	host = {URL}

 

혹은 git config --global -l 명령을 통해서도 설정 상태를 확인하실 수 있습니다.

$ git config --global -l
user.email=abc@abc.com
user.name=gil-dong-hong
credential.helper=store
hub.host={URL}

 

GUI 환경이라면 gitk도 설치해줍니다.

$ sudo apt-get install gitk

 


[curl 패키지 설치]

curl 명령을 수행하려고 하니까, curl도 설치가 안 되어있네요. sudo apt-get install curl 명령을 통해서 curl을 설치해줍니다.

$ curl
Command 'curl' not found, but can be installed with:
sudo apt install curl
$ sudo apt-get install curl

 

만약 특정 버젼의 curl 패키지를 설치하고자 하신다면 frankler.tistory.com/46을 참조하시기 바랍니다. 

 


 

[python 설치]

python으로 작성된 스크립트가 수행되지 못하네요. python 패키지도 설치해줍니다.

$ sudo apt-get install python

 

 

[gcc 설치]

$ sudo apt-get install gcc make

 


 

[docker 설치]

제가 software 개발자다 보니까 docker 역시도 많이 사용하고 있습니다. docker도 설치해줍니다. 

docker를 쉘에 입력해보면 어떻게 설치하는지 쉘이 친절하게 설명해줍니다.

sudo apt-get install docker.io 명령을 통해서 docker를 설치하겠습니다.

$ docker

Comand 'docker' not found, but can be installed with:

sudo snap install docker    # version 19.03.11, or
sudo apt install docker.io   # version 19.03.8-0ubuntu1.20.04.2

See 'snap info docker' for additional version.

$ sudo apt-get install docker.io

 

docker run hello-world 명령을 이용해서 docker가 정상적으로 설치되었는지 확인합니다.

$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

 

"/var/run/docker.sock: connect: permission denied." 라는 에러 메시지가 뜨는데 이는 docker를 실행하는 계정의 권한이 추가되지 않았기 때문입니다. sudo usermod -aG docker gil-dong 명령을 통해서 docker 그룹에 계정을 추가합니다.

 

$ sudo usermod -aG docker gil-dong

 

cat /etc/group | grep docker 명령으로 docker 그룹에 계정이 제대로 추가되었는지 확인합니다.

$ cat /etc/group | grep docker
docker:x:133:gil-dong

 

docker 서비스를 재시작해줘야 합니다. sudo service docker restart 명령으로 docker 서비스를 재시작합니다.

$ sudo service docker restart

 

docker를 재시작해줬음에도 불구하고 docker 권한 문제가 계속되면, reboot를 해보시는 것도 괜찮은 방법입니다.

$ docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

 

위와 같이 hello-world가 제대로 실행되면 docker 설치가 완료된 것입니다. 

 


 

[samba 설치]

sudo apt-get install samba 명령을 이용해서 samba 패키지를 설치합니다.

$ sudo apt-get install samba

 

 

[mailutils 설치]

sudo apt-get install mailutils 명령을 이용해서 mailutils를 설치합니다.

$ mail

Command 'mail' not found. but can be installed with:

sudo apt install mailutils

$ sudo apt-get install mailutils

 

 

[mono-runtime 패키지 설치]

리눅스에서 Windows 실행파일을 실행하고 싶을 때가 있습니다. 이 때는 mono-runtime 패키지를 설치하면 됩니다.

$ sudo apt-get install mono-runtime

 

 

[끝맺음 말]

이상으로 Ubuntu Linux를 처음 설치하고 설치해야 하는 패키지들에 대해서 살펴보았습니다. 제가 SW 개발자다 보니까 SW 개발환경에 너무 치중한 상태로 글을 작성하게 된 것 같네요. 

 

이상입니다. 

반응형