'Unix/Linux'에 해당되는 글 13건

  1. 2021.12.30 Ubuntu 16.04 Python3 설치
  2. 2021.12.21 Patch 사용 오류 수정 (different line endings)
  3. 2021.01.20 Ubuntu 16.4 python 3.6 설치
  4. 2020.09.22 svn 등록 및 사용하기
  5. 2020.04.28 .bashrc가 자동으로 실행되지 않을 때.
  6. 2018.11.13 linux log level 설정
  7. 2016.07.28 This is Automake 1.15, but the definition used by this AM_INIT_AUTOMAKE comes from Automake 1.6.3.
  8. 2014.02.27 tgz 압축/푸는 법
  9. 2014.02.27 .svn 파일 삭제하는법
  10. 2013.03.15 Linux에서 getch() 구현

Ubuntu 16.04 Python3 설치

Unix/Linux 2021. 12. 30. 15:09

 

1. 소스 설치에 필요한 기본라이브러리

$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
    libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

 

 

2. 파이썬 다운 (최신버전인 3.10.1 기준)

$ cd /opt
$ sudo wget https://www.python.org/ftp/python/3.10.1/Python-3.10.1.tgz
$ sudo tar xzf Python-3.10.1.tgz

 

 

3. 컴파일

$ cd Python-3.10.1
$ sudo ./configure --enable-optimizations
$ sudo make altinstall

 

 

4. 버젼확인

$ python3.10 -V
Python 3.10.1

 

 

5. 디폴트 설정

update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 1

 

5-1 설정 확인

$ python -V
Python 3.10.1

 

 

5-2. python 설정 경로를 못찾을 경우(whereis 명령어로 검색)

$ whereis python3
python3: /usr/bin/python3.5-config /usr/bin/python3.5m /usr/bin/python3 /usr/bin/python3.5 /usr/bin/python3.5m-config /usr/lib/python3 /usr/lib/python3.5 /etc/python3 /etc/python3.5 /usr/local/bin/python3.10-config /usr/local/bin/python3.8-config /usr/local/bin/python3.10 /usr/local/bin/python3.8 /usr/local/lib/python3.5 /usr/local/lib/python3.10 /usr/local/lib/python3.8 /usr/include/python3.5m /usr/include/python3.5 /usr/share/python3 /usr/share/man/man1/python3.1.gz

 

5-3. update-alternatives 버젼이 여러개라 설정이 안될 경우(파일 삭제 후 install 해도 버젼이 바뀌지 않을때)

$ sudo update-alternatives --config python
대체 항목 python에 대해 (/usr/bin/python 제공) 3개 선택이 있습니다.

  선택       경로                     우선순� 상태
------------------------------------------------------------
  0            /usr/local/bin/python3.8    1         자동 모드
  1            /usr/bin/python2.7          1         수동 모드
  2            /usr/local/bin/python3.10   1         수동 모드
* 3            /usr/local/bin/python3.8    1         수동 모드

Press <enter> to keep the current choice[*], or type selection number:

 

'Unix/Linux' 카테고리의 다른 글

Patch 사용 오류 수정 (different line endings)  (0) 2021.12.21
Ubuntu 16.4 python 3.6 설치  (0) 2021.01.20
svn 등록 및 사용하기  (0) 2020.09.22
.bashrc가 자동으로 실행되지 않을 때.  (0) 2020.04.28
linux log level 설정  (0) 2018.11.13
:

Patch 사용 오류 수정 (different line endings)

Unix/Linux 2021. 12. 21. 10:57

 

Code Merge  작업을 하다보면 수정된 코드에 대해서

Patch 가 적용 안되고 아래와 같은 오류가 발생할 때가 있다.

 

Hunk #1 FAILED at 2755 (different line endings).
Hunk #2 FAILED at 2974 (different line endings).

 

line 등에 문제가 있는지 확인 했지만 해결되지 않아서

코드에 pacth 내용를 적용하여 새로 patch를 만들어 확인해 보니

 

diff -urN config_a.c config_b.c > patch.patch

 

코드 라인에 에디터에선 보이지 않던 "^M"이 붙어 있는 것을 확인됬다.

Beyond Compare 를 사용중인데 저장과정에서 파일 포멧 변경이 발생한 것으로 보인다.

수정 방법는 patch 파일을 수정하거나 수정된 파일을 수정 하거나 선택하면 되는데 내 경우에는 파일을 수정를 선택했다.

 

 

포멧 변경에는 'dos2unix' 명령을 사용한다. 명령어가 없다면 설치해야한다.

 

sudo apt-get install dos2unix

 

 

 

아래 명령으로 하위 디렉토리까지 모두 변환 가능하다.

 

find . -print | xargs dos2unix

 

 

 

 

'Unix/Linux' 카테고리의 다른 글

Ubuntu 16.04 Python3 설치  (0) 2021.12.30
Ubuntu 16.4 python 3.6 설치  (0) 2021.01.20
svn 등록 및 사용하기  (0) 2020.09.22
.bashrc가 자동으로 실행되지 않을 때.  (0) 2020.04.28
linux log level 설정  (0) 2018.11.13
:

Ubuntu 16.4 python 3.6 설치

Unix/Linux 2021. 1. 20. 17:00

최초 설치시 ubuntu 16.4에서는 python3 3.5.2 버젼이 설치 되어있다.

최근에 사용하는 tool에서 python3 3.6이상의 버젼을 요구하는 경우가 있어 업그레이드가 필요하다.

 

# python 3.5 업데이트 

sudo apt-get install python3
sudo apt-get update
sudo apt-get upgrade python3

 

# python 3.6 패키지 추가 및 설치 

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6

 

# python 3.6 패키지 추가 및 설치 

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo update-alternatives --config python3      0번: auto mode 선택

 - Ubuntu 16.04에 많은 시스템 프로그램에서 python3.5를 사용하고 있어서 default 버젼을 변경했을때 시스템 프로그램(터미널, 프로그램 업데이트 등)이 제대로 동작하지 않는다는 것을 알았다. 디폴트 버젼은 유지한 상태로 사용하도록 변경한다.

 

# path 설정

make ~/bin
cd ~/bin
ln -s /usr/bin/python3.6 ~/bin/python3

.bash_profile 에 아래 추가
export PATH="~/bin:$PATH"

 

 

# 버젼 확인

python3 --version            Python 3.6.x 버젼이 나오면 설치완료

 

'Unix/Linux' 카테고리의 다른 글

Ubuntu 16.04 Python3 설치  (0) 2021.12.30
Patch 사용 오류 수정 (different line endings)  (0) 2021.12.21
svn 등록 및 사용하기  (0) 2020.09.22
.bashrc가 자동으로 실행되지 않을 때.  (0) 2020.04.28
linux log level 설정  (0) 2018.11.13
:

svn 등록 및 사용하기

Unix/Linux 2020. 9. 22. 15:47

1. svn 서버에서 할일

1) 저장소 생성

// SVN 디렉토리이동
# cd /home/svn/project
// 현재 위치에 저장소 생성
# svnadmin create --fs-type fsfs simple

2) 환경설정

# cd /home/svn/project/simple/conf

# vi passwd (계정 및 패스워드)

simpleID = simplePW

# vi svnserve.conf

anon-access = none
auth-access = write
password-db = passwd

2. svn 클라이언트에서 할일

1) trunk 생성

// 외부
#
svn mkdir --parents svn://100.0.0.1/project/simple/trunk —username=simpleID
// 로컬
svn mkdir --parents svn://localhost/project/simple/trunk —username=simpleID

2) checkout

# svn co svn://100.0.0.1/project/simple/trunk simple

3) 확인

# svn info simple/

 

 

:

.bashrc가 자동으로 실행되지 않을 때.

Unix/Linux 2020. 4. 28. 09:47

 

터미널을 시작할 때 '/usr/bin/login'이 되는데 

특정 플랫폼에서는 ~/.bashrc 를 로그인 과정에서 사용하지 않는 경우가 있다.

 

~/.bashrc가 사용되지 않을 때는 보통 다음 순서대로 파일을 읽는다.

1. /etc/profile

2. ~/.bash_profile

3. ~/.bash_login

4. ~/.profile

 

~/.bashrc에 동작하도록 수정하고 싶다면

~/.profile 안에 아래 소스내용을 추가 한다.

if [ -s ~/.bashrc ]; then
    source ~/.bashrc;
fi

 

:

linux log level 설정

Unix/Linux 2018. 11. 13. 17:16

# cat /proc/sys/kernel/printk

6 4 1 7


=> 6 Console Log Level

      4 busybox default MessageLog Level

      1 Minimum Console Log Level

      7 default Console Log Level



#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */
#define KERN_ERR "<3>" /* error conditions */
#define KERN_WARNING "<4>" /* warning conditions */
#define KERN_NOTICE "<5>" /* normal but significant condition */
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */



모든 메시지 출력

echo 7 4 1 7 > /proc/sys/kernel/printk


모든 메시지 출력 안되도록 설정

echo 0 4 1 7 > /proc/sys/kernel/printk

또는 

echo "0" > /proc/sys/kernel/printk


.config 의 dmesg 항목에

CONFIG_MESSAGE_LOGLEVEL_DEFAULT = 4 를 추가하면 2번째 항목이 변경되는 것으로 확인되어서


arch/arm64/boot/dts에 .dts 파일에 있는 bootarg 에

loglevel=3

를 추가해서 console level를 조정하였다.


:

This is Automake 1.15, but the definition used by this AM_INIT_AUTOMAKE comes from Automake 1.6.3.

Unix/Linux 2016. 7. 28. 11:48

최근 유분투 운영체계에서는 automake 1.1x  버젼이 설치되어 사용되는 데 그 하위에 버젼 같은 경우는 설치도 잘 안된다.


하지만 automake의 경우 하위 버젼과 호환이 되지 않는 문제가 있어

하위 버젼으로 만들었던 소스가 컴파일되지 않을때 아래와 같은 문제가 발생한다.


warning: autoconf input should be named 'configure.ac', not 'configure.in'

configure.in:3: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:

configure.in:3: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation

configure.in:3: error: version mismatch.  This is Automake 1.15,

configure.in:3: but the definition used by this AM_INIT_AUTOMAKE

configure.in:3: comes from Automake 1.6.3.  You should recreate

configure.in:3: aclocal.m4 with aclocal and run automake again.


문제가 발생하는 폴더에서

# automake --add-missing

# autoreconf 



'Unix/Linux' 카테고리의 다른 글

.bashrc가 자동으로 실행되지 않을 때.  (0) 2020.04.28
linux log level 설정  (0) 2018.11.13
tgz 압축/푸는 법  (0) 2014.02.27
.svn 파일 삭제하는법  (0) 2014.02.27
Linux에서 getch() 구현  (0) 2013.03.15
:

tgz 압축/푸는 법

Unix/Linux 2014. 2. 27. 18:33

압축 할때

tar cvzpf abc.tgz /home


압축 풀때

tar -xzvf abc.tgz

:

.svn 파일 삭제하는법

Unix/Linux 2014. 2. 27. 18:32

하위 폴더에 있는 것까지 삭제


 find . -name .svn -print0 | xargs -0 rm -rf


:

Linux에서 getch() 구현

Unix/Linux 2013. 3. 15. 16:18

#include <stdio.h>
#include <termio.h>

 int getch(void)
    {
        int ch;
        struct termios buf, save;
        tcgetattr(0,&save);
        buf = save;
        buf.c_lflag &= ~(ICANON|ECHO);
        buf.c_cc[VMIN] = 1;
        buf.c_cc[VTIME] = 0;
        tcsetattr(0, TCSAFLUSH, &buf);
        ch = getchar();
        tcsetattr(0, TCSAFLUSH, &save);
        return ch;
    }

 

'Unix/Linux' 카테고리의 다른 글

tgz 압축/푸는 법  (0) 2014.02.27
.svn 파일 삭제하는법  (0) 2014.02.27
Linux에서 _kbhit() 구현  (0) 2013.03.15
^M 문자  (0) 2013.03.14
vi 편집기 사용법  (0) 2013.03.14
: