Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 674. WSL 2 환경에서 GNU Octave 설치 [링크 복사], [링크+제목 복사],
조회: 4389
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

(시리즈 글이 7개 있습니다.)
개발 환경 구성: 335. Octave의 명령 창에서 실행한 결과를 복사하는 방법
; https://www.sysnet.pe.kr/2/0/11309

개발 환경 구성: 388. Windows 환경에서 Octave 패키지 설치하는 방법
; https://www.sysnet.pe.kr/2/0/11622

개발 환경 구성: 674. WSL 2 환경에서 GNU Octave 설치
; https://www.sysnet.pe.kr/2/0/13319

개발 환경 구성: 675. Windows Octave 8.1.0 - Python 스크립트 연동
; https://www.sysnet.pe.kr/2/0/13320

개발 환경 구성: 676. WSL/Linux Octave - Python 스크립트 연동
; https://www.sysnet.pe.kr/2/0/13321

개발 환경 구성: 677. Octave에서 Excel read/write를 위한 io 패키지 설치
; https://www.sysnet.pe.kr/2/0/13323

.NET Framework: 2108. C# - Octave의 "save -binary ..."로 생성한 바이너리 파일 분석
; https://www.sysnet.pe.kr/2/0/13324




WSL 2 + Ubuntu 환경에서 GNU Octave 설치

예전에 Windows에서 Octave를 설치했었는데요, 근래에 나온 8.1.0 버전의 경우 윈도우에서는 JRE 문제도 없어졌습니다.

이번에는, 재미 삼아 WSL 2 환경의 Ubutn 20.04 또는 18.04에서 Octave를 다음의 명령어로 설치해 보겠습니다.

$ sudo apt update && sudo apt upgrade -y

$ sudo apt install octave         // 필수
$ sudo apt install liboctave-dev  // 선택

// 제거

$ sudo apt remove octave
$ sudo apt remove liboctave-dev

음... 버전이 좀 아쉽군요. ^^

$ octave --version
GNU Octave, version 5.2.0
Copyright (C) 2020 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.

20.04의 경우 5.2.0 버전이 설치되고, 18.04의 경우에는 4.2.2 버전이 설치됩니다. 문서에 보면 별도의 ppa repo를 추가하면 된다고 하는데요, 그런데 실제로 해보면,

$ sudo add-apt-repository ppa:octave/stable
 The latest version of GNU Octave built for all supported Ubuntu releases. GNU Octave is normally distributed with Ubuntu, this PPA is for you if you have a need to use a newer version of Octave than what you can already get from your installed version of Ubuntu.

Simply follow the instructions below to add this PPA to your system and install the octave package. If it's not that easy or you encounter any errors, contact the team and let us know.

Much credit goes to the Debian Octave Group who maintain the official Debian packages that this work is derived from. Without their efforts to bring Octave packaging to such a high level of quality in Debian and Debian derivatives, this PPA would not be here.
 More info: https://launchpad.net/~octave/+archive/ubuntu/stable
Press [ENTER] to continue or Ctrl-c to cancel adding it.

0% [Connecting to archive.ubuntu.com (185.125.190.39)] [Waiting for headers] [Connecting to ppa.launchpad.net (2620:2d:sHit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Ign:2 http://ppa.launchpad.net/octave/stable/ubuntu bionic InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease                                      d
Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Err:6 http://ppa.launchpad.net/octave/stable/ubuntu bionic Release
  404  Not Found [IP: 185.125.190.52 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/octave/stable/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

// 제거 방법
$ sudo add-apt-repository ppa:octave/stable --remove

이렇게 오류가 발생합니다. 오류가 발생한 "http://ppa.launchpad.net/octave/stable/ubuntu" 링크를 가보면, ./dists 하위에 있는 각각의 폴더명에 대해 대응하는 코드명은 이렇게 됩니다.

devel
lucid (10.04)
natty (11.04)
oneiric (11.10)
precise (12.04)
quantal (12.10)
saucy (13.10)
trusty (14.04)
vivid (15.04)
xenial (16.04)

18.04의 경우 bionic이고 20.04의 경우 focal이기 때문에 결국 18.04 이후로는 "ppa:octave/stable" repo에서 더 이상 업데이트가 안 된 것입니다. (문서에 2018년까지 유지됐다고 합니다.) 게다가 WSL은 Ubuntu 16.04 버전은 배포를 하지 않기 때문에,

C:\temp> wsl -l -o
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.

NAME                                   FRIENDLY NAME
Ubuntu                                 Ubuntu
Debian                                 Debian GNU/Linux
kali-linux                             Kali Linux Rolling
Ubuntu-18.04                           Ubuntu 18.04 LTS
Ubuntu-20.04                           Ubuntu 20.04 LTS
Ubuntu-22.04                           Ubuntu 22.04 LTS
OracleLinux_8_5                        Oracle Linux 8.5
OracleLinux_7_9                        Oracle Linux 7.9
SUSE-Linux-Enterprise-Server-15-SP4    SUSE Linux Enterprise Server 15 SP4
openSUSE-Leap-15.4                     openSUSE Leap 15.4
openSUSE-Tumbleweed                    openSUSE Tumbleweed

딱히 해볼 것이 없군요. ^^ (이때까지만 해도 있었는데.)




일단, apt 명령어는 그렇고 또 다른 패키지 관리자로 snap을 이용해 보겠습니다. ^^ 그 전에, 다음의 글에 따라 snap을 활성화시키고,

WSL 2 Ubuntu 20.04 - error: cannot communicate with server: Post http://localhost/v2/snaps/...
; https://www.sysnet.pe.kr/2/0/13317

설치하면,

$ sudo snap install octave
octave 7.1.0 from GNU Octave (octave-snap✓) installed

최신 버전(8.1.0)은 아니지만 7.1.0 버전이 설치됩니다. 뭐 그런대로, 소스코드로부터 빌드하는 것이 아닌 이상 이 정도면 만족해야겠습니다. ^^

마지막으로, WSL 2에서 다음과 같이 실행해 주면,

$ octave --force-gui

// 또는,

$ nohup octave --force-gui &

윈도우 환경과 연계해 이렇게 잘 실행됩니다.

wsl2_octave7_1.png




참고로, snap으로 설치한 octave는 이렇게 위치하고 있습니다.

$ ll /snap/octave
total 8
drwxr-xr-x  3 root root 4096 Apr 11 00:09 ./
drwxr-xr-x  9 root root 4096 Apr 11 00:09 ../
drwxr-xr-x 12 root root    0 Apr 21  2022 306/
lrwxrwxrwx  1 root root    3 Apr 11 00:09 current -> 306/

$ ll /snap/octave/306
total 0
drwxr-xr-x  2 root root 0 Apr 21  2022 bin/
drwxr-xr-x 19 root root 0 Apr 21  2022 etc/
drwxr-xr-x  3 root root 0 Apr 21  2022 include/
drwxr-xr-x  7 root root 0 Apr 21  2022 lib/
drwxr-xr-x  3 root root 0 Apr 21  2022 libexec/
drwxr-xr-x  3 root root 0 Apr 21  2022 meta/
drwxr-xr-x  7 root root 0 Apr 21  2022 share/
drwxr-xr-x  3 root root 0 Apr 21  2022 snap/
drwxr-xr-x  7 root root 0 Mar 15  2022 usr/
drwxr-xr-x  4 root root 0 Apr 21  2022 var/

또한, 기본적으로 python 3.6을 포함하고 있습니다.

$ ll /snap/octave/306/usr/bin/python3
lrwxrwxrwx 1 root root 9 Oct 25  2018 /snap/octave/306/usr/bin/python3 -> python3.6*

$ /snap/octave/306/usr/bin/python3.6
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

나중에 설명하겠지만, 아쉽게도 7.1.0 버전에서는 위의 python3.6이 Octave의 "python" 명령에 연결되지 않습니다.




snap으로 설치한 octave를 실행하면 초기에 이런 오류 메시지들이 나옵니다.

$ octave
QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000/snap.octave', please create it with 0700 permissions.
Fontconfig warning: "/etc/fonts/fonts.conf", line 5: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/fonts.conf", line 6: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/fonts.conf", line 6: invalid attribute 'translate'
...[생략]...
Fontconfig error: "/etc/fonts/conf.d/90-synthetic.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/conf.d/90-synthetic.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/conf.d/90-synthetic.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/conf.d/90-synthetic.conf", line 6: invalid attribute 'version'
Fontconfig error: Cannot load config file from /etc/fonts/fonts.conf

처음의 XDG_RUNTIME_DIR 오류는 그 메시지에서 알려주는 대로 다음과 같은 처리를 하면 됩니다.

$ mkdir -p /run/user/1000/snap.octave
$ chmod 0700 /run/user/1000/snap.octave

그다음, fonts.conf에서 발생하는 오류를 검색해 보면, 2.12.x 버전의 config을 사용하는 프로그램이 2.13.x 버전으로 업그레이드된 시스템에서 발생하는 문제라고 합니다. 실제로 제 Ubuntu에는 2.13.1이었는데요,

$ sudo apt show fontconfig
Package: fontconfig
Version: 2.13.1-2ubuntu3
Priority: optional
Section: utils
...[생략]...

그렇다면 아마도 Octave 7.1.0 버전은 2.12.x를 대상으로 빌드된 듯합니다. 이에 대해 딱히 방법은 없는 것 같고, its 네임스페이스를 갖는 노드가 문제가 되는 것이므로 그것만 삭제해 해결했다는 글이 나옵니다. 일례로, 오류가 나는 파일들 중 하나를 보면,

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
    <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
        <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
    </its:rules>

    <description>Default configuration file</description>
    
    ...[생략]...
</fontconfig>

오류 메시지에서 지적하고 있는 내용이 저렇게 꼭 포함이 됩니다. 그래서 다음의 명령어로 해당 XML 노드를 삭제해 주면 됩니다.

// https://stackoverflow.com/questions/62348866/how-to-fix-fontconfig-warning-unknown-elements-error

$ sudo sed -i '/<description/d; /its\:/d' /etc/fonts/fonts.conf /etc/fonts/conf.d/*conf

그나저나, 혹시 8.1.0 버전을 소스코드 빌드 없이 repo에서 설치하는 방법은 없는 걸까요? ^^ 현재로서는 docker를 이용하는 것이 그나마 나은 듯합니다.

docker pull docker.io/gnuoctave/octave:8.1.0




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 4/12/2023]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... [16]  17  18  19  20  21  22  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
13237정성태1/30/20235575.NET Framework: 2091. C# - 웹 사이트가 어떤 버전의 TLS/SSL을 지원하는지 확인하는 방법
13236정성태1/29/20235127개발 환경 구성: 663. openssl을 이용해 인트라넷 IIS 사이트의 SSL 인증서 생성
13235정성태1/29/20234691개발 환경 구성: 662. openssl - 윈도우 환경의 명령행에서 SAN 적용하는 방법
13234정성태1/28/20235783개발 환경 구성: 661. dnSpy를 이용해 소스 코드가 없는 .NET 어셈블리의 코드를 변경하는 방법 [1]
13233정성태1/28/20237165오류 유형: 840. C# - WebClient로 https 호출 시 "The request was aborted: Could not create SSL/TLS secure channel" 예외 발생
13232정성태1/27/20234911스크립트: 43. uwsgi의 --processes와 --threads 옵션
13231정성태1/27/20233873오류 유형: 839. python - TypeError: '...' object is not callable
13230정성태1/26/20234240개발 환경 구성: 660. WSL 2 내부로부터 호스트 측의 네트워크로 UDP 데이터가 1개의 패킷으로만 제한되는 문제
13229정성태1/25/20235263.NET Framework: 2090. C# - UDP Datagram의 최대 크기
13228정성태1/24/20235352.NET Framework: 2089. C# - WMI 논리 디스크가 속한 물리 디스크의 정보를 얻는 방법 [2]파일 다운로드1
13227정성태1/23/20235036개발 환경 구성: 659. Windows - IP MTU 값을 바꿀 수 있을까요? [1]
13226정성태1/23/20234736.NET Framework: 2088. .NET 5부터 지원하는 GetRawSocketOption 사용 시 주의할 점
13225정성태1/21/20233928개발 환경 구성: 658. Windows에서 실행 중인 소켓 서버를 다른 PC 또는 WSL에서 접속할 수 없는 경우
13224정성태1/21/20234339Windows: 221. Windows - Private/Public/Domain이 아닌 네트워크 어댑터 단위로 방화벽을 on/off하는 방법
13223정성태1/20/20234520오류 유형: 838. RDP 연결 오류 - The two computers couldn't connect in the amount of time allotted
13222정성태1/20/20234211개발 환경 구성: 657. WSL - DockerDesktop.vhdx 파일 위치를 옮기는 방법
13221정성태1/19/20234403Linux: 57. C# - 리눅스 프로세스 메모리 정보파일 다운로드1
13220정성태1/19/20234504오류 유형: 837. NETSDK1045 The current .NET SDK does not support targeting .NET ...
13219정성태1/18/20234062Windows: 220. 네트워크의 인터넷 접속 가능 여부에 대한 판단 기준
13218정성태1/17/20234004VS.NET IDE: 178. Visual Studio 17.5 (Preview 2) - 포트 터널링을 이용한 웹 응용 프로그램의 외부 접근 허용
13217정성태1/13/20234616디버깅 기술: 185. windbg - 64비트 운영체제에서 작업 관리자로 뜬 32비트 프로세스의 덤프를 sos로 디버깅하는 방법
13216정성태1/12/20234856디버깅 기술: 184. windbg - 32비트 프로세스의 메모리 덤프인 경우 !peb 명령어로 나타나지 않는 환경 변수
13215정성태1/11/20236506Linux: 56. 리눅스 - /proc/pid/stat 정보를 이용해 프로세스의 CPU 사용량 구하는 방법 [1]
13214정성태1/10/20235979.NET Framework: 2087. .NET 6부터 SourceGenerator와 통합된 System.Text.Json [1]파일 다운로드1
13213정성태1/9/20235463오류 유형: 836. docker 이미지 빌드 시 "RUN apt install ..." 명령어가 실패하는 이유
13212정성태1/8/20235243기타: 85. 단정도/배정도 부동 소수점의 정밀도(Precision)에 따른 형변환 손실
... [16]  17  18  19  20  21  22  23  24  25  26  27  28  29  30  ...