본문 바로가기
SWE/Linux

리눅스 서버 구축 | 리눅스 개발 환경 세팅

by S나라라2 2022. 2. 10.
반응형

리눅스를 재설치 하자

Ubuntu 설치할 때 '디스크 지우고 Ubuntu 설치'옵션을 눌러서 포맷을 노린다.

 

1. Bootable usb만들기

(1)usb 포맷 타입

(2)~.iso 다운로드

 

2. BIOS - USB로 시스템 부팅하기

(1)설치 usb를 꽂고 시스템의 전원을 on한다.

(2) 재빠르게 shift/F4키를 눌러 BIOS에 진입한다.

(BIOS 진입 키는 메인보드에 따라 다름)

Nucbox는 ESC키 누르기

(3) Boot메뉴에 들어가서 USB가 부팅 우선순위 1순위로 바꾼다.

 

3. 리눅스 설치

(1) 설치 USB로 부팅해서 'Ubuntu 설치'옵션 클릭해서 진행한다.

(2) 설치 완료 되면 재부팅된다. 재부팅할 때 설치 usb 제거한다.

 


환경 구축

 

1. root 계정 활성화

$ sudo passwd root //비밀번호 설정

$ su - root // root 계정으로 전환. 활성화

# exit //로그아웃

 

참고로, 현재 root 계정이면 명령어 앞에 '#'라고 표시함

 

2. 네트워크 설정

# ip addr show // 현재 ip 확인. 아직 ifconfig설치하지 않아서 없음

# vi /etc/netplan/01-network-manager-all.yaml

// 해당 파일을 vi나 nano로 열어서 아래와 같이 편집해준다.

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp1s0: # 환경에 따라 다르게
      dhcp6: no
      addresses: [192.144.67.36/24]
      gateway4: 192.144.67.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

$ sudo netplan apply // 새 설정 적용

 

3. 패키지들 설치

// 업데이트

# apt update

# apt-get -y udate

 

// 패키지 설치

// 아래 패키지들 모두 설치할 필요 없다. 필요한 것만 설치하면 됨

// 개인적으로 필수라고 생각되는 것들만 나열했다.

# apt install -y net-tools unzip tree openssh-server samba git systemd nfs-kernel-server

 

// 빌드 환경 패키지 설치

$ apt-get install libsnmp-dev unzip libpcre++-dev libblkid* libasound2-delibxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libdrm-dev libgl-dev ctags qtbase5-dev python lib32z1-dev gcc-multilib g++-multilib  htop lrzsz cmake snmp 

 

// open ssh 실행

# systemctl enable ssh

 

안해도 됌. 개인 취향

// git 설정

$git config --global alias.co checkout

$git cofnig --global alias.br branch

$git config --global alias.ci commit

$git config --global alias.st status

 

// python 2.7 설치

$apt-get install python-pip 

$ ln -s /usr/local/bin/pip.27 /usr/local/bin/pip   // python2.7링킹

 

 

4. user 계정 생성

# sudo adduser flower.0

# sudo adduser flower.0 --force-badname #

# cat /etc/passwd

 

$ sudo mkdir /home/flower.0/.ssh

$ sudo chown flower.0:flower.0 flower.0 // 각 폴더에 권한 주기

$ sudo usermod -d /home1/flower.0 flower.0 // 홈 디렉토리 설정

 

 

5. samba 세팅

 

6.Fstab 세팅

 

7. nfs 세팅

$ vi /etc/exports  // 해당 파일 열어서 아래와 같이 추가

home/flower.0 *(rw,sync,no_subtree_check) // home/flower.0 폴더를 공유한다. 모든 ip(*)에 개방한다.

 


apt-get update 에러 - DDNS 문제 해결방법

 

  • 에러 내용

# apt-get update
Err:1
http://kr.archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'kr.archive.ubuntu.com'
Err:2
http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3
http://kr.archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'kr.archive.ubuntu.com'
Err:4
http://kr.archive.ubuntu.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'kr.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch
http://kr.archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'kr.archive.ubuntu.com'
W: Failed to fetch
http://kr.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'kr.archive.ubuntu.com'
W: Failed to fetch
http://kr.archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'kr.archive.ubuntu.com'
W: Failed to fetch
http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

 

  • ddns 확인해보기

# ping security.ubuntu.com
ping: security.ubuntu.com: Temporary failure in name resolution

 

  • 해결 방법 1 - nameserver 을 8.8.8.8로 수정

$ vi /etc/resolv.conf
nameserver 8.8.8.8

 

해결 방법 2 - 회사 사이트 dns 확인하기

$ vi /etc/hosts

파일 열어서 편집하기

회사 se DNS ip 추가하기

 

 

 

 

 

 

 

 

 

 

 

 

 

반응형