1. AWS EC2 접속
2. AMI 버전 확인
$ grep . /etc/*-release
/etc/os-release:NAME="Amazon Linux AMI"
/etc/os-release:VERSION="2017.03"
/etc/os-release:ID="amzn"
/etc/os-release:ID_LIKE="rhel fedora"
/etc/os-release:VERSION_ID="2017.03"
/etc/os-release:PRETTY_NAME="Amazon Linux AMI 2017.03"
/etc/os-release:ANSI_COLOR="0;33"
/etc/os-release:CPE_NAME="cpe:/o:amazon:linux:2017.03:ga"
/etc/os-release:HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
/etc/system-release:Amazon Linux AMI release 2017.03
3. Java 1.8 설치
$ java -version
java version "1.7.0_151"
OpenJDK Runtime Environment (amzn-2.6.11.0.74.amzn1-x86_64 u151-b00)
OpenJDK 64-Bit Server VM (build 24.151-b00, mixed mode)
$ sudo yum install java-1.8.0
$ sudo yum remove java-1.7.0
$ java -version
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-b16)
OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode)
4. Scala 설치
$ wget https://downloads.lightbend.com/scala/2.12.3/scala-2.12.3.tgz
$ tar xzvf scala-2.12.3.tgz
$ sudo su -
# cd /home/ec2-user/
# mv scala-2.12.3 /usr/local/scala
# exit
$ sudo vi /etc/profile
export PATH=$PATH:/usr/local/scala/bin
$ source /etc/profile
$ scala -version
Scala code runner version 2.12.3 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
5. Spark 설치
* 주의 사항 : AWS t2.large 인스턴스 정도가 되어야 정상 동작함 (t2.small에서는 Spark Streaming 정상 동작 하지 않음)
$ wget https://d3kbcqa49mib13.cloudfront.net/spark-2.2.0-bin-hadoop2.7.tgz
$ tar xvzf spark-2.2.0-bin-hadoop2.7.tgz
$ sudo su -
# cd /home/ec2-user/
# mv spark-2.2.0-bin-hadoop2.7 /usr/local/spark
# exit
$ sudo vi /etc/profile
export PATH=$PATH:/usr/local/spark/bin
$ source /etc/profile
$ spark-shell
6. Kafka 설치 및 데몬 실행
$ wget http://apache.mirror.cdnetworks.com/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz
$ tar xzvf kafka_2.11-0.11.0.0.tgz
$ ln -s kafka_2.11-0.11.0.0 kafka
$ bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
$ bin/kafka-server-start.sh -daemon config/server.properties
7. MongoDB 설치 및 서비스 실행
$ sudo su
# vi /etc/yum.repos.d/mongodb-org-3.4.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
# yum install -y mongodb-org
# service mongod start
# mongo
# exit
8. Redis 설치 및 서비스 실행
$ sudo yum -y update
$ sudo yum -y install gcc make
$ sudo wget http://download.redis.io/redis-stable.tar.gz
$ tar xvzf redis-stable.tar.gz
$ cd redis-stable
$ sudo make install
$ sudo mkdir -p /etc/redis /var/lib/redis /var/redis/6379
$ sudo cp redis.conf /etc/redis/6379.conf
$ sudo vi /etc/redis/6379.conf
daemonize yes
logfile /var/log/redis_6379.log
dir /var/redis/6379
$ sudo wget https://raw.githubusercontent.com/saxenap/install-redis-amazon-linux-centos/master/redis-server
$ sudo mv redis-server /etc/init.d
$ sudo chmod 755 /etc/init.d/redis-server
$ sudo vi /etc/init.d/redis-server
REDIS_CONF_FILE="/etc/redis/6379.conf"
$ sudo chkconfig --add redis-server
$ sudo chkconfig --level 345 redis-server on
$ sudo service redis-server start
9. Node.js 개발 환경 구축
$ sudo yum install git-core
$ sudo yum install nodejs npm --enablerepo=epel
$ npm -v
1.3.6
$ sudo npm update -g npm
$ npm -v
5.3.0
$ npm install
$ sudo npm cache clean -f
$ sudo npm install -g n
$ sudo n 6.11.1
$ node -v
v0.10.48
재접속
$ node -v
v6.11.1
10. Maven 개발 환경 구축
$ sudo yum install java-1.8.0-openjdk-devel.x86_64
$ sudo alternatives --config java
$ sudo alternatives --config javac
$ javac -version
javac 1.8.0_141
$ sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
$ sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
$ sudo yum install -y apache-maven
$ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /usr/share/apache-maven
Java version: 1.7.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.9.38-16.35.amzn1.x86_64", arch: "amd64", family: "unix"
------------------
<참고자료>
리눅스 버전 확인
AMI에 JDK 1.8 설치
http://blog.naver.com/PostView.nhn?blogId=typez&logNo=221020775376&redirect=Dlog&widgetTypeCall=true
스칼라 및 스파크 설치
http://www.w3ii.com/ko/apache_spark/apache_spark_installation.html
카프카 설치
https://blog.knoldus.com/2017/04/19/installing-and-running-kafka-on-aws-instance-centos/
몽고디비 설치
레디스 설치
웹 프론트 개발 환경 구축
Node.js 최신 버전 설치
NPM 최신 버전 설치
https://askubuntu.com/questions/562417/how-do-you-update-npm-to-the-latest-version
$ npm -v
2.15.1
$ sudo npm update -g npm
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@3.10.9 /usr/local/lib/node_modules/npm
$ npm -v
3.10.9
Maven 설치
http://bhargavamin.com/how-to-do/install-jenkins-on-amazon-linux-aws/
sudo yum install -y git java-1.8.0-openjdk-devel aws-cli
sudo alternatives --config java
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn –v
AWS EC2 t2.micro Swap 할당하는 방법
$ dd if=/dev/zero of=/swapfile bs=1M count=1024 $ mkswap /swapfile $ swapon /swapfile $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
출처: http://nashorn.tistory.com/623 [나숑의 법칙]
'연구개발 > Linux' 카테고리의 다른 글
VirtualEnv Wrapper를 이용한 파이썬 가상환경 설정 (0) | 2017.04.05 |
---|---|
centos fdisk (0) | 2017.03.30 |
ubuntu 방화벽 (0) | 2016.03.14 |
zabbix mail setting (0) | 2016.03.03 |
swap (0) | 2016.03.02 |