Centos7로 홈서버 만들기
CentOS 7 최소설치 진행(vmware 상에서 진행)
ifconfig 명령을 실행할 수 없다면 다음 명령을 실행
yum install net-tools
고정 아이피 설정
lan카드 이름 확인 내경우는 enp2s0
ifconfig
ifcfg-enp2s0 편집
vi /etc/sysconfig/network-scripts/ifcfg-enp2s0
다음과 같이 편집
#BOOTPROTO="dhcp"
BOOTPROTO="static"
IPADDR="192.168.60.129"
NETMAST="255.255.255.0"
GATEWAY="192.168.219.1"
# vmware 상일 경우
# C:\Program Files (x86)\VMware\VMware Workstation\vmnetcfg.exe 실행 후
# NET Setting 의 Gateway IP를 GATEWAY에 기입해준다.
DNS1="1.214.68.2"
DNS2="61.41.153.2"
네트워크 재시작
systemctl restart network
ssh 서버 설치
yum install -y openssh-server
systemctl enable sshd
systemctl restart sshd
firewall-cmd --add-service=ssh --permanent
firewall-cmd --reload
windows 10에서 OpenSSH Client로 putty 없이 접근가능
cmd
ssh root@192.168.60.129
패스워드 입력
윈도우와의 파일공유를 위한 samba 서버 구축
yum install samba* -y
yum list installed | grep samba
mkdir /home/samba
chmod 777 /home/samba
useradd sambauser
passwd sambauser #암호는 sambauserpassword
smbpasswd -a sambauser #암호는 sambauserpassword
vi /etc/samba/smb.conf
변경 및 추가
[global]
workgroup = WORKGROUP
hosts allow = 192.168.219.
[samba]
path = "/home/samba"
public = yes
writable = yes
write list = sambauser
create mask = 0777
directory mask = 0777
systemctl enable smb
systemctl start smb
firewall-cmd --permanent --add-port=139/tcp
firewall-cmd --permanent --add-port=445/tcp
firewall-cmd --reload
setsebool -P samba_enable_home_dirs on
chcon -t samba_share_t /home/samba
윈도우에서 \\192.168.60.129로 접속 id : sambauser pwd : sambauserpassword
MariaDB 설치
일단 semanage 명령을 사용하기 위해서 다음명령 실행
yum install policycoreutils-python
저장소 목록 생성 후 마리아 DB 설치
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
yum install MariaDB-server
MariaDB 서비스를 부팅시 자동으로 실행되게 설정을 변경
systemctl enable mariadb
MariaDB를 시작합니다.
systemctl start mariadb
MariaDB의 root암호 및 기본 보안 설정을 하기위해 아래의 명령어를 실행합니다.
mysql_secure_installation
여러 질문에 적절하게 선택
보안상 기본포트를 변경 3456으로 작업
이 명령으로 현재 허용된 포트를 알아냄
semanage port -l | grep mysqld_port_t
3456을 허용된 포트에 추가
semanage port -a -t mysqld_port_t -p tcp 3456
vi /etc/my.cnf.d/server.cnf
편집
[mysqld]
port = 3456
systemctl restart mariadb
firewall-cmd --permanent --add-port=3456/tcp
firewall-cmd --reload
MariaDB계정생성
mysql -u root -p
create user ‘아이디’@'%' identified by ‘패스워드';
grant all privileges on *.* to ‘생성한아이디'@'%' identified by ‘패스워드';
flush privileges;
Apache 설치
yum install -y httpd
설정파일과 로그파일 위치 확인 : ls /etc/httpd
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
systemctl enable httpd
systemctl start httpd
아피치 버전 확인하기
ps -ef | grep httpd # /usr/sbin/httpd 라고 나온다면 버전에 따라 /usr/bin/httpd 라고 나올수도 있다
/usr/sbin/httpd -v #Apache/2.4.6 (CentOS) 라고 나왔다.
http://192.168.60.129 접속하여 아파치 초기화면 확인
Tomcat 설치
yum install -y tomcat*
설치된 경로 확인
cd /usr/share/tomcat
윈도우 pc 에서 jdk 설치를 위해 싸이트 접속 http://www.oracle.com/technetwork/java/javase/downloads/index.html
jdk download 를 누르면 다음 페이지 나옴 https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html
jdk-12_linux-x64_bin.rpm 을 윈도우 pc의 c:\ 하위에 다운로드
c:\jdk-12_linux-x64_bin.rpm 파일을 \\192.168.60.129\samba 로 copy
리눅스로 돌아와서
cd /home/samba
rpm -ivh jdk-8u131-linux-x64.rpm
alternatives --config java # 명령을 실행하여 jdk12로 되어있는 목록의 번호를 입력하고 엔터
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
systemctl enable tomcat
systemctl start tomcat
http://192.168.60.129:8080 접속하여 톰캣 초기화면 확인
아파치 , Tomcat 연동
http://gnujava.com/board/article_view.jsp?board_no=12&article_no=1814
댓글남기기