Centos 7 에 vns server , python 3 설치
서버에 리눅스 그래픽모드를 처음 깔았다.
selenium 을 사용하여 데이터를 크롤링하기 위해서는 아무래도 그래픽 모드가 필요했기 때문....
그러다 보니 GUI모드를 원격으로 제어할 수 있는 VNC Server 도 설치..
아래는 그 과정이다.
################################################## 기본설정
## 언어
[root@localhost ~]# vi /etc/locale.conf
LANG="ko_KR.UTF-8"
################################################## VNC Server
yum groupinstall "GNOME Desktop"
yum install tigervnc-server
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service
vi /etc/systemd/system/vncserver@\:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l ecouser -c "/usr/bin/vncserver %i"
PIDFile=/home/ecouser/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
###### 자동실행 설정, 실행
systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service
###### 사용자 추가
useradd ecouser
###### vnc로 접속할 유저로 전환 후, vncserver 실행
su – ecouser
vncserver
---> 패스워드 설정
###### 방화벽 설정
firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload
###### reboot
# VNC Viewer 에서 접속
VNC Server: IP주소:5901
################################################## 크롬 설치
## repo 설정
vi /etc/yum.repos.d/google-chrome.repo
[google-chrome]
name=google-chrome
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
## 설치
yum install google-chrome-stable
################################################## Python 3 설치
############# Repository 추가
[root@localhost ~]# yum install -y https://centos7.iuscommunity.org/ius-release.rpm
############# yum 으로 설치
[root@localhost ~]yum install python36u python36u-libs python36u-devel python36u-pip
############# link 설정
[root@localhost ~]# ln -s /bin/python3.6 /bin/python3
############# pip link 설정
[root@localhost ~]# ls -l /bin/pip*
-rwxr-xr-x. 1 root root 370 1월 20 2017 /bin/pip3.6
[root@localhost ~]# ln -s /bin/pip3.6 /bin/pip
pip install --upgrade pip
pip install selenium
pip install bs4
pip install pymysql