본문 바로가기
개발 업무(코딩)-개발자였을때 썼던..

리눅스 서버 설치(대략적인 순서)

by 주용사 2023. 1. 9.
728x90

centos 설치완료 후 버전체크

1. cat /etc/redhat-release -> 버전 체크 7.7.1908

2. 비프음 끄기

- ls -al

- .bash_profile 열어서 맨 밑에 setterm -blength 0 추가

- . .bash_profile로 적용

3. sshd 설치확인

- rpm -qa | grep openssh-server

- yum install openssh-server

- which sshd

- firewall-cmd --zone=public --add-port=22/tcp --permanent(디비 유저권한 준다음 db포트도 열어줘야함)

- firewall-cmd --reload (포트 재로딩)

- firewall-cmd --list-ports (열린 포트 확인하는 방법)

- vim /etc/ssh/sshd_config

- PermitrootLogin no

- service sshd start

4. Centos7 고정 IP 설정 방법

- /etc/sysconfig/network-scripts/ifcfg-xxx 이 위치에 있는 파일 open

파일명은 이더넷 장치에 따라 각각 다르며, 해당 파일을 수정함으로써 IP의 설정값을 자유롭게 변경할 수 있음.

- 설정 파일안에서

BOOTPROTO="dhcp" 해당 라인을 주석

제일 아래에 추가

BOOTPROTO="static"

IPADDR="xxx.xxx.xxx.xxx"

NETMASK="255.255.255.0"

GATEWAY="xxx.xxx.xxx.1"

DNS1="111.111.63.1"

DNS2="111.111.63.2"

- systemctl restart network

5. mariadb 설치

- yum install mariadb-server

- systemctl enable mariadb

- systemctl start mariadb

- /usr/bin/mysqladmin -u root password 'root패스워드' /* 루트계정 비밀번호 생성 */ -> 접속해서 확인

- mysql_secure_installation

-> Setting_secure_instaillation

1. Change the root password ? -> N

2. Remove anonymous users ? -> Y

3. Disallow root login remotely? -> Y

4. Remove test database and access to it? -> n

5. Reload privilege tables now ? -> y

6. mariadb 경로설정

- 문서 파일 참조

7. 파이썬 설치

- yum install -y https://centos7.iuscommunity.org/ius-release.rpm

- yum install -y python36u

- yum install -y python36u-devel

- yum install -y python36u-pip

- # vi /root/.bashrc

alias python="/usr/bin/python3.6" <= 내용 추가

# tqtap2 해당 사용자 계정에도 설정

vi ~/.bashrc

alias python="/usr/bin/python3.6"

- curl 'https://bootstrap.pypa.io/get-pip.py'

- yum install python3-pip

- pip3 install numpy

- pip3 install pandas

- yum install gcc-c++

- pip3 install cvxpy

- pip3 install pymysql

8. mariadb 유저 생성 및 권한 설정

- 문서 파일 참조

9. mysql.h 나 라이브러리가 없을때

- yum install mysql-devel

- 라이브러리가 잘안잡힐때 있는 데 그때는 경로 조정해서 잡아줘야함

728x90