갈루아의 반서재



1. Java JDK 설치

1
# conda install -c cyclus java-jdk=8.45.14
cs


2. 스칼라 설치 및 실행

1
# conda install -c anaconda-cluster scala=2.11.1
cs


Hello, World! 실행

1
2
3
4
5
6
7
8
9
10
# scala
 
Setting up SCALA_HOME for scala to /root/anaconda/envs/tensorflow/share/scala-2.11.1 ...
Launching scala
 
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions to have them evaluated.
Type :help for more information.
 
scala>
cs


1
2
3
4
5
6
7
8
9
scala> object HelloWorld {
     | def main(args: Array[String]) {
     |     println("Hello, World!")
     | }
     | }
defined object HelloWorld
 
scala> HelloWorld.main(null)
Hello, World!
cs



3. 쥬피터 커널에 스칼라 추가 (Jupyter Scala 설치 : https://github.com/alexarchambault/jupyter-scala)

1) 쥬피터 설치여부 확인 (버전 4.0 이상이어야함)

1
2
# jupyter --version
4.2.0
cs


2) 쥬피터 스칼라 다운로드 및 설치

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# curl -L -o jupyter-scala https://git.io/vrHhi && chmod +x jupyter-scala && ./jupyter-scala && rm -f jupyter-scala
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   150  100   150    0     0     82      0  0:00:01  0:00:01 --:--:--   643
100 14186  100 14186    0     0   5493      0  0:00:02  0:00:02 --:--:--  130k
Generated /root/.local/share/jupyter/kernels/scala211/kernel.json
 
Run jupyter console with this kernel with
  jupyter console --kernel scala211
 
Use this kernel from Jupyter notebook, running
  jupyter notebook
and selecting the "Scala 2.11" kernel.
cs


3) 커널 설치 확인

1
2
3
4
# jupyter kernelspec list
Available kernels:
  python2     /root/anaconda/envs/tensorflow/lib/python2.7/site-packages/ipykernel/resources
  scala211    /root/.local/share/jupyter/kernels/scala211
cs


4) 실행