'Linux'에 해당하는 글 33건

https://www.linux.com/learn/how-run-your-own-git-server


위 글을 참고하였으며

필자는 GCE에 git server를 설치하였다


--- SSH key 생성 및 서버에 등록 ---


# 서버에서 다음을 수행

sudo apt-get install git-core

sudo useradd -m -s /bin/bash git


# 로컬에서 다음을 수행

ssh-keygen 대신 XSHELL에서 RSA 키 생성 (git_rsa_2048) (패스워드는 없이 하자, 그렇지 않으면 git push 할때마다 작성해야함)

내보내기를 통해 git_rsa_2048.pem과 git_rsa_2048.pub 파일을 저장


 - GCE에 SSH public key를 등록 (필자의 다른 포스트에 자세한 방법이 포스팅 되어있음, GCE - Metadata - SSH 키 탭에서 가능)

 - 로컬머신(일반적으로 윈도우즈)에서는 %사용자 디렉토리%/.ssh 디렉토리에, 위 두 파일을 저장해주자


이제 아래 커맨드를 통해 GCE 서버의 git 계정에 접속할 수 있다

ssh -i ~/.ssh/git_rsa_2048.pem git@your-own-server


--- SSH config ---


http://ssaemo.tistory.com/338

위 글을 참고하여, SSH 클라이언트(일반적으로 윈도우즈일 것이다)에서

~/.ssh/config에 ssh host와 identity file을 세팅해주자


config을 작성한 후부터는 -i 옵션 없이 git 계정에 접속할 수 있다

ssh git@your-own-server


ssh가 안될경우, -v 옵션을 붙여서 디버깅해보자

ssh -v git@your-own-server


--- Remote Repository 생성 ---


ssh git@your-own-server 접속


# 서버에서 다음을 수행

mkdir -p /home/git/push_test.git

cd $_

git init --bare


--- local repository 생성 ---


# 로컬에서 다음을 수행

mkdir push_test

cd $_

git init


commit 하기위한 파일을 하나 생성한다 (example: main.py)


git add .

git commit -m "Initial commit"


--- push test ---


git remote add origin git@your-own-server:push_test.git # 경로는 git 홈디렉토리에 있는 디렉토리이다

git push origin master


성공적으로 push 될 것이다

실패한다면 local repo에서 commit을 했는지 확인해보자


git clone git@your-own-server:push_test.git


clone도 잘 작동한다

생각보다 간단하게 git-core 패키지를 통해 git server를 설치할 수 있었다


'Linux' 카테고리의 다른 글

SSH Options, config (SSH 키, 개인 키)  (0) 2018.06.21
Xilinx Gnome-power error  (0) 2018.04.17
[linux] ia32-libs - ubuntu 최신버전 (>=14.04)  (0) 2018.03.28
[Linux] 한글 인코딩  (1) 2018.03.21
[Linux] sudo path 설정방법  (0) 2018.03.20

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

접속이 안될 때 (예: Permission Denied (public key)) deubgging에 유용

ssh -v user@hostname


id_rsa가 아닌 다른 키를 사용해 SSH 접속할 경우

ssh -i ~/.ssh/id_rsa user@hostname


위와 같이 매번 -i 옵션을 사용하고 싶지 않거나, 사용할 수 없을 때 (예: own git server에 git push 할 때 등)

~/.ssh/config 파일을 생성하고 아래와 같은 syntax로 작성

windows(git bash)/linux 모두 위와 같이 설정하면 됨. system config은 /etc/ssh/ssh_config


Host <HOST>

User git

HostName <hostname>

IdentityFile ~/.ssh/git_rsa.pem



'Linux' 카테고리의 다른 글

Debian/Ubuntu Linux에 Git Server 설치하기  (0) 2018.06.21
Xilinx Gnome-power error  (0) 2018.04.17
[linux] ia32-libs - ubuntu 최신버전 (>=14.04)  (0) 2018.03.28
[Linux] 한글 인코딩  (1) 2018.03.21
[Linux] sudo path 설정방법  (0) 2018.03.20

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

Xilinx Gnome-power error

Linux 2018. 4. 17. 02:14

https://stackoverflow.com/a/32578786


리눅스 GUI에서 화면이 뜨지 않을 때, console로 진입하는 핫키는 Ctrl+Alt+F2이다


Xilinx default user

user: ise

password: xilinx




WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

http://nicejhong.tistory.com/entry/Dev-Ubuntu-1404%EC%97%90%EC%84%9C-ia32libs-%EC%84%A4%EC%B9%98%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95


alternative package를 설치하여 해결하였다


'Linux' 카테고리의 다른 글

SSH Options, config (SSH 키, 개인 키)  (0) 2018.06.21
Xilinx Gnome-power error  (0) 2018.04.17
[Linux] 한글 인코딩  (1) 2018.03.21
[Linux] sudo path 설정방법  (0) 2018.03.20
[Linux] MongoDB Install, Deploy(Bind)  (0) 2018.03.19

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

[Linux] 한글 인코딩

Linux 2018. 3. 21. 00:46

python3인데 자꾸 print()에서 UnicodeDecodeError: ascii codec can't ... 에러가 발생한다


1. locale에서 LANG=ko_KR.UTF-8 임을 확인

2. LANG= 일경우 export LANG=ko_KR.UTF-8 실행

자세한 건 아래 사이트 참고

https://beomi.github.io/2017/07/10/Ubuntu-Locale-to-ko_KR/


3. terminal의 인코딩이 UTF-8 임을 확인


4. python print 다시 실행해보기



'Linux' 카테고리의 다른 글

Xilinx Gnome-power error  (0) 2018.04.17
[linux] ia32-libs - ubuntu 최신버전 (>=14.04)  (0) 2018.03.28
[Linux] sudo path 설정방법  (0) 2018.03.20
[Linux] MongoDB Install, Deploy(Bind)  (0) 2018.03.19
[Linux] tail command - log trace (real-time)  (0) 2018.03.16

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

http://forum.falinux.com/zbxe/index.php?mid=lecture_tip&document_srl=805204


sudo /usr/sbin/visudo 커맨드를 실행하면

Defaults secure_path 라는 설정을 확인할 수 있다

이것을 수정하면 된다


WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

환경: GCE Debian Linux


sudo apt install mongodb


sudo vi /etc/mongodb.conf


# bind_ip = 127.0.0.1

bind_ip = 0.0.0.0


sudo /etc/init.d/mongodb restart

sudo /etc/init.d/mongodb status




Firewall rule에서 27017 port open

certification 필요없음


'Linux' 카테고리의 다른 글

[Linux] 한글 인코딩  (1) 2018.03.21
[Linux] sudo path 설정방법  (0) 2018.03.20
[Linux] tail command - log trace (real-time)  (0) 2018.03.16
[Linux] [vsftpd] default ftp mode  (0) 2018.03.16
[Linux] my vim config  (0) 2018.03.10

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

tail -f -n 1 $LOG_FILE


'Linux' 카테고리의 다른 글

[Linux] sudo path 설정방법  (0) 2018.03.20
[Linux] MongoDB Install, Deploy(Bind)  (0) 2018.03.19
[Linux] [vsftpd] default ftp mode  (0) 2018.03.16
[Linux] my vim config  (0) 2018.03.10
[Linux] /etc/passwd, /etc/group, /etc/shadow  (0) 2018.03.09

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

<default config>

pasv_enable=YES


vsftpd는 default mode가 passive 모드이다

passive mode는 data를 송신하기 위하여 client가 server로 접속하는 방식이다


ftp localhost

...

passive # passive mode on/off

ls # passive mode=on일 때, ls는 passive mode server에서만 동작한다



'Linux' 카테고리의 다른 글

[Linux] MongoDB Install, Deploy(Bind)  (0) 2018.03.19
[Linux] tail command - log trace (real-time)  (0) 2018.03.16
[Linux] my vim config  (0) 2018.03.10
[Linux] /etc/passwd, /etc/group, /etc/shadow  (0) 2018.03.09
[Linux] jobs, fg (re-attach)  (0) 2018.03.09

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

[Linux] my vim config

Linux 2018. 3. 10. 14:28

~/.vimrc 파일을 생성하고 다음과 같이 입력한다 (NOT .viminfo)
("는 주석기호)

" tab size
set ts=4
set sw=4
set sts=4
set cindent
set smartindent

"set term=cygwin

" insert mode에서 Shift Tab -> Ctrl D로 mapping (inverse indent)
inoremap <S-Tab> <C-d>

. ~/.vimrc 할 필요 없다
시스템의 vim 설정파일은 /etc/vim/vimrc




WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

/etc/passwd 파일의 syntax


<username>:x:<uid>:<gid>:<optional_info>:<home_dir>:<shell_path>


x가 들어가는 자리는 과거 password의 자리로, 현재는 /etc/shadow 파일로 따로 관리된다


/etc/shadow 파일은 패스워드를 hash해서 저장한다는 것만 알아두자




다음으로 /etc/group 파일의 syntax


<group_name>:x:<gid>:<user, user, ...>


유저는 여러개의 그룹에 속할 수 있다


test라는 유저를 생성하면, 기본적으로 자신의 이름과 똑같이 test라는 그룹을 생성하고 그 그룹에 join한다

이것이 /etc/passwd 파일에서 확인할 수 있는 gid


그리고 debian의 경우 

/usr/sbin/adduser USER GROUP 

커맨드를 통해 특정 유저를 특정 그룹에 add할수 있다


이렇게 add한 group들은 /etc/group 파일에서 확인할 수 있다



'Linux' 카테고리의 다른 글

[Linux] [vsftpd] default ftp mode  (0) 2018.03.16
[Linux] my vim config  (0) 2018.03.10
[Linux] jobs, fg (re-attach)  (0) 2018.03.09
[Linux] GCE Adduser quickstart (SSH Key, sudo)  (0) 2018.03.09
[Linux] Install Java(JDK) by apt-get  (0) 2018.03.07

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

Ctrl+Z로 프로그램을 stop시킬 경우, 프로세스는 여전히 실행되어있다

아래 커맨드로 확인할 수 있다


jobs [-l]


그리고 re-attach하려면 아래 커맨드를 통해 가능하다


fg # ForeGround의 약자


마지막으로 해당 process를 kill 하려면 jobs -l을 통해 PID 확인 후 kill -9 해주면 된다


kill -9 <PID>




WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

GCE: Google Cloud Engine


<Key Pair 생성하기>

 - on Linux

KEY=test_rsa_2048

USER=test

sudo adduser $USER

ssh-keygen -t rsa -f ~/.ssh/$KEY -C $USER


"이제 이 Private Key를 SSH Client에서 다운로드 받아야함. permission 때문에 굉장히 귀찮음"


 - on XShell

(생략)


"GCE의 Private Key를 download 받는 것이 아니라, upload하면 됨 (간단)"


<ssh key 확인>

~/.ssh/$KEY.pub 파일을 열어보면, 다음과 같은 template을 갖는다

ssh-rsa [KEY_VALUE] [USERNAME]

chmod 400 ~/.ssh/$KEY


GCP Web Console Page - Computer Engine - Metadata - SSH Key

SSH Key에 방금 생성한 public key를 등록하자


<user를 /etc/sudoers에 추가>

sudo /usr/sbin/adduser $USER google-sudoers


GCE에서는 google-sudoers에 속해있는 user들에게 sudo 권한이 주어진다


더 일반적인 리눅스에서의 방법으로는 


sudo /usr/sbin/visudo


위 커맨드를 통해서 /etc/sudoers 에 아래 라인을 추가해주면 된다


root ALL=(ALL:ALL) ALL의 아래에 같은 형식으로

[USERNAME] ALL=(ALL:ALL) ALL


visudo를 사용하면 필자의 경우 default editor로 nano가 사용되었는데, 이것을 vim으로 바꿀수 있다. 아래 커맨드를 사용하여


sudo update-alternatives --config editor


위 커맨드를 실행한 후 vim.basic을 선택한 후 visudo를 실행하면 vim으로 실행되는 것을 확인할 수 있을것이다




WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/


sudo apt-get install default-jdk


https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

외국 서버에서 패키지를 다운받으면 느리다. 그래서 코리아 미러서버를 사용하려 한다.


sources.list


# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

# newer versions of the distribution.

deb http://ftp.daumkakao.com/ubuntu/ xenial main restricted

# deb-src http://ftp.daumkakao.com/ubuntu/ xenial main restricted


## Major bug fix updates produced after the final release of the

## distribution.

deb http://ftp.daumkakao.com/ubuntu/ xenial-updates main restricted

# deb-src http://ftp.daumkakao.com/ubuntu/ xenial-updates main restricted


## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team. Also, please note that software in universe WILL NOT receive any

## review or updates from the Ubuntu security team.

deb http://ftp.daumkakao.com/ubuntu/ xenial universe

deb-src http://ftp.daumkakao.com/ubuntu/ xenial universe

deb http://ftp.daumkakao.com/ubuntu/ xenial-updates universe

deb-src http://ftp.daumkakao.com/ubuntu/ xenial-updates universe


## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

## team, and may not be under a free licence. Please satisfy yourself as to

## your rights to use the software. Also, please note that software in

## multiverse WILL NOT receive any review or updates from the Ubuntu

## security team.

deb http://ftp.daumkakao.com/ubuntu/ xenial multiverse

# deb-src http://ftp.daumkakao.com/ubuntu/ xenial multiverse

deb http://ftp.daumkakao.com/ubuntu/ xenial-updates multiverse

# deb-src http://ftp.daumkakao.com/ubuntu/ xenial-updates multiverse


## N.B. software from this repository may not have been tested as

## extensively as that contained in the main release, although it includes

## newer versions of some applications which may provide useful features.

## Also, please note that software in backports WILL NOT receive any review

## or updates from the Ubuntu security team.

deb http://ftp.daumkakao.com/ubuntu/ xenial-backports main restricted universe multiverse

# deb-src http://ftp.daumkakao.com/ubuntu/ xenial-backports main restricted universe multiverse


## Uncomment the following two lines to add software from Canonical's

## 'partner' repository.

## This software is not part of Ubuntu, but is offered by Canonical and the

## respective vendors as a service to Ubuntu users.

# deb http://archive.canonical.com/ubuntu xenial partner

# deb-src http://archive.canonical.com/ubuntu xenial partner


deb http://ftp.daumkakao.com/ubuntu/ xenial-security main restricted

# deb-src http://ftp.daumkakao.com/ubuntu/ xenial-security main restricted

deb http://ftp.daumkakao.com/ubuntu/ xenial-security universe

deb-src http://ftp.daumkakao.com/ubuntu/ xenial-security universe

deb http://ftp.daumkakao.com/ubuntu/ xenial-security multiverse

# deb-src http://ftp.daumkakao.com/ubuntu/ xenial-security multiverse


위 파일은 default sources.list 파일에서 archive.ubuntu.com과 security.ubuntu.com을 ftp.daumkakao.com으로 replace한 파일이다


/etc/apt/sources.list 에 위 파일을 overwrite하자


아래에 docker에서 사용하는 방법 중 하나를 소개한다


cat > /etc/apt/sources.list

복사한 내용 paste 후 Ctrl+D




WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

top

ps



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

/srv/ftp



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

df -h -T

fdisk -l

lsblk


du



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

참고 문서

https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html

https://discuss.elastic.co/t/elasticsearch-only-accessible-from-localhost/65782/4


Elasticsearch PGP Key를 Import한다


wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

apt repo를 add한다


sudo apt-get install apt-transport-https


echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list

update 후 elasticsearch install

sudo apt-get update && sudo apt-get install elasticsearch

elasticsearch는 mysql, nginx 등처럼 자동으로 시작되지 않는다
우선 아래 커맨드로 자신의 시스템이 init과 systemd 중 어떤 SysV를 사용하는지 확인해보자


ps -p 1

elasticsearch를 start&stop하는 방법은 SysV에 따라 갈린다

필자의 경우 systemd이다


systemd의 경우 아래 커맨드로 elasticsearch가 부팅시마다 자동으로 실행되게 할수있다


sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service


start&stop은 아래 커맨드로 할수있다 (start를 해주면 드디어 elasticsearch가 실행된다. 그리고 시작하는데에 약간 시간이 걸린다)


sudo systemctl start elasticsearch.service sudo systemctl stop elasticsearch.service sudo systemctl status elasticsearch.service sudo systemctl restart elasticsearch.service


완전히 시작될 때까지 기다린 후 아래 커맨드로 잘 실행되었는지 확인해보자


curl -XGET localhost:9200


default setting은 localhost로 bind되어있으므로, /etc/elasticsearch/elasticsearch.yml에서 network.host를 0.0.0.0으로 설정해주자

그리고 restart


------------- 추가 ---------


GUI Client, 라이브러리, 플러그인 등의 호환을 위해 

elasticsearch5 이하 설치 추천


아래 커맨드도 사용할수 있다

sudo /etc/init.d/elasticsearch status


플러그인은? ...


'Linux' 카테고리의 다른 글

[Linux] vsftpd anonymous public default location  (0) 2018.02.22
[Linux] Disk 관련 커맨드  (0) 2018.02.21
[Linux] Nginx config  (0) 2018.02.18
[Linux] Nginx syntax highlight install  (0) 2018.02.18
[Linux] apt-get auto-completion  (0) 2018.02.18

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

[Linux] Nginx config

Linux 2018. 2. 18. 21:20

HTTP 모듈?은 세 가지 논리적 블럭을 제공한다.

 - 프로토콜 수준 (http 블럭)
 - 서버 수준 (server 블럭)
 - 요청 URL 수준 (location 블럭) ★

<example>
http
{
server
{
listen 80;
...

location / 
{
...
}

location ~ \.php$
{
...
}
}
...
}

모듈 지시어 : 블록 내에 배치된다?

 - listen <Port> IP?; : 웹사이트용 리스닝 소켓이 사용하는 IP 주소와 포트 설정
    ex: listen 80;
 - root <root>; : 웹파일들이 위치한 루트를 정의
    ex: root /usr/share/nginx/html;
 - index <...>; : 인덱스 파일을 정의한다.
    ex: index index.php index.html index.htm;
 - proxy_pass <URL> : 요청을 해당 URL로 pass 한다.
    ex: proxy_pass http://localhost:8080;


----


/etc/nginx/nginx.conf

위 파일은 아래 디렉토리 내의 conf들을 include한다

/etc/nginx/conf.d/ 그리고 /etc/nginx/sites-available (여기에는 default 파일이 있음)

즉, conf 파일을 분리하여 관리할수 있다



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

https://arian.io/vim-syntax-highlighting-for-nginx/


'Linux' 카테고리의 다른 글

[Linux] Install Elasticsearch on Debian linux  (0) 2018.02.20
[Linux] Nginx config  (0) 2018.02.18
[Linux] apt-get auto-completion  (0) 2018.02.18
[Linux] vsftpd - anonymous SFTP(FTP) server  (0) 2018.02.12
[Linux] tmux란? / 단축키  (0) 2017.12.14

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

https://askubuntu.com/a/203013


cp /etc/skel/.bashrc ~/

source ~/.bashrc


/etc/skel?

https://joojy.net/p/20170607262


default home directory contents


---


apt-get install bash-completion

'Linux' 카테고리의 다른 글

[Linux] Nginx config  (0) 2018.02.18
[Linux] Nginx syntax highlight install  (0) 2018.02.18
[Linux] vsftpd - anonymous SFTP(FTP) server  (0) 2018.02.12
[Linux] tmux란? / 단축키  (0) 2017.12.14
[Linux] xshell or putty를 통해 GCE SSH 접속  (0) 2017.12.14

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

이 글의 목적은

Debian Linux에서 anonymous FTP server를 열고, 

anonymous에게 Upload, Read 뿐만 아니라 Modify, Delete도 가능하도록 권한을 설정해주는 것이다


실습환경: GCE Debian Linux (Google Cloud Engine)


우선 커맨드부터 설명한다


# vsftpd 설치

sudo apt install -y vsftpd

# vsftpd config

sudo vi /etc/vsftpd.conf

# vsftpd restart (service 커맨드와 달리 성공/실패 메세지가 뜬다)

sudo /etc/init.d/vsftpd restart


제일 중요한 config 설정방법에 대해서 설명한다


anonymous_enable=YES # allow anonymous connect

write_enable=YES

anon_upload_enable=YES

anon_mkdir_write_enable=YES # for mkdir

anon_other_write_enable=YES # for DELE

anon_umask=022 # for READ


기본생성되는 vsftpd example config에 없는 옵션들이 있어서 삽질을 좀 했다 (anon_other_write_enable, anon_umask)



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

[Linux] tmux란? / 단축키

Linux 2017. 12. 14. 01:20

<tmux란?>

TMUX: Terminal MUltipleXer


리눅스 쉘을 사용하다보면 아래와 같은 어려움들을 겪는다

 - 쉘을 여러개 사용할 때

    - SSH Client shell의 경우, 세션이 타임아웃되어 expired됨 -> 매번 다시연결

 - 쉘 윈도우를 switch하는 게 번거로움

 - 쉘을 종료했다가 다시 실행할 때 이전 작업들이 그대로 남아있었으면 좋겠음


tmux은 위와 같은 어려움들의 솔루션이 되어준다. 실제 현업에서도 많이 쓰는듯하다.


<설치>

ubuntu 기준 아래 커맨드를 이용하여 설치할 수 있고

sudo apt install tmux


<사용법>

간단하게 아래 명령어를 통하여 tmux 세션을 생성 및 attach 할수있다

tmux # new with SESSION_NAME = 0

tmux new -s $SESSION_NAME


default prefix key-binding은 Ctrl+b이다

아래 단축키로 tmux session으로부터 detach할수있다

Ctrl+b, d


아래 커맨드로 detach한 session에 다시 attach할수있다

tmux attach -t 0 # == tmux a


아래 단축키를 사용하여 pane을 split해보자

Ctrl+b, %(Shift+5)

Ctrl+b, "(Shift+')


아래 단축키를 통해 split된 pane들을 자유롭게 이동할 수 있다

Ctrl+b, arrow (이 때도 컨트롤 누르면 안됨)


%를 입력할 때 Ctrl 키를 누르고있으면 동작하지 않는다..

물론 위는 기본 키 설정이고, 본인 스타일대로 conf 가능하다

다른 단축키들은 자주 쓴다싶으면 추가서술할 예정이다


---


<추가>

tmux ls

tmux a       # tmux attach

Ctrl+b, PgUp # 화면 스크롤

Ctrl+b, x    # close split pane


<단축키 참고>

https://gist.github.com/MohamedAlaa/2961058


win10 docker, xshell에서도 잘 동작한다


WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

<공식 문서>

아래 사이트를 참조했다

아래 사이트에는 putty를 기준으로 설명되어있다

https://cloud.google.com/compute/docs/instances/connecting-to-instance#standardssh

필자는 xshell을 기준으로 설명하려 한다


<xshell로 GCE 접속 - 키 생성 및 등록>

xshell - 도구 - 사용자 키 생성 마법사

RSA 2048비트로 pub/ppk 키를 생성하였다

개인키의 암호(passphrase)는 옵션이다

키 생성이 완료되면 개인키 ppk(PEM private key)는 xshell이 알아서 저장하고, pub(public key)를 보여준다

이것을 GCE 프로젝트의 메타데이터에 등록하면 된다


GCE 페이지 좌측 메뉴 - 메타데이터 탭 - SSH 키 탭으로 접속

필자의 경우에는 기본적으로 두 개의 SSH 키가 이미 생성되어있는 상태였다


그 아래에 항목 추가를 눌러주고

pub 키를 붙여넣고, 마지막에 username을 적어주면 된다

(필자의 경우, 위 SSH 키 2개랑 똑같이 구글계정을 username으로 적어주었다)

이제 공개 키 저장을 끝냈으므로, xshell로 접속하면 된다


<xshell로 GCE 접속>

xshell을 실행하고, 새로운 세션을 생성한다

프로토콜 = SSH

호스트 = "GCE의 외부 IP주소"

연결 - 사용자 인증 탭

 - 방법 = "public key"

 - 사용자이름 = "메타데이터의 SSH키 탭에서 설정한 username" (root 아님)

 - 사용자 키 = 아까 생성한 ppk

 - 암호 = 아까 생성시 설정한 passphrase (optional)


위와 같이 설정후 접속하니 성공적으로 connect 되었다


--- 추가 ---


<Xshell의 사용자 키 경로>

필자의 경우 아래의 디렉토리에 저장되어 있었다

%내 문서%\NetSarang Computer\6\SECSH\UserKeys

xshell에서 사용하는 개인 키(비밀 키)의 확장자는 pri를 사용하는 듯 하다 (putty는 pem이었던 것으로 기억)

내보내기를 통해 pri -> pem이 가능하다


<GCE에 공개 SSH 키(RSA) 등록>

GCP - Computer Engine - Metadata 탭 접속


'Linux' 카테고리의 다른 글

[Linux] vsftpd - anonymous SFTP(FTP) server  (0) 2018.02.12
[Linux] tmux란? / 단축키  (0) 2017.12.14
[Linux] bash -c jupyter notebook -> don't source .bashrc  (0) 2017.12.06
[Linux] .a 파일 vs .so 파일  (0) 2017.12.06
Raspberry Pi make 에러  (1) 2017.12.04

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

docker exec -it ubuntu bash -c 'jupyter notebook --ip='*' --allow-root --no-browser /root'


위 커맨드를 실행했을 때, PYTHONPATH env가 set되지 않는 문제가 있었다

~/.bashrc나 /etc/bash.bashrc에 세팅을 해도, jupyter notebook에는 세팅되지 않았다


정확하게 말하면 bash -c 'cmd'는 .bashrc를 source하지 않는다

솔루션은 다음과 같다


docker exec -it ubuntu bash -c 'PYTHONPATH=/usr/local jupyter notebook --ip='*' --allow-root --no-browser /root'



'Linux' 카테고리의 다른 글

[Linux] tmux란? / 단축키  (0) 2017.12.14
[Linux] xshell or putty를 통해 GCE SSH 접속  (0) 2017.12.14
[Linux] .a 파일 vs .so 파일  (0) 2017.12.06
Raspberry Pi make 에러  (1) 2017.12.04
[Linux] .vimrc on docker win7  (0) 2017.11.30

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

https://stackoverflow.com/questions/9809213/what-are-a-and-so-files


archive 파일은 static linking 파일로서 컴파일 할때 (gcc -c) 사용된다

archive 파일의 코드를 변경할 경우 recompile 해야한다는 단점이 있다


shared object 파일을 archive 파일과 비교했을 때의 장점은 runtime에서 linking된다는 것이다

shared object 파일의 코드를 변경할 경우, so 파일만 바꿔주면 되므로 프로그램을 recompile 할 필요가 없다


'Linux' 카테고리의 다른 글

[Linux] xshell or putty를 통해 GCE SSH 접속  (0) 2017.12.14
[Linux] bash -c jupyter notebook -> don't source .bashrc  (0) 2017.12.06
Raspberry Pi make 에러  (1) 2017.12.04
[Linux] .vimrc on docker win7  (0) 2017.11.30
[Linux] hash -r 기능  (0) 2017.11.29

WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

Raspberry Pi make 에러

Linux 2017. 12. 4. 15:54

<문제상황>

raspberry pi에서 caffe2를 make하는데 c++ internal error가 발생했다


<해결방법>

make -j $(nproc) 옵션을 make로 바꾸었더니 해결되었다

make jobs 옵션을 설정하면 메모리 사용량이 증가하고, 메모리가 부족하게되어 에러가 발생하는듯하다




WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

[Linux] .vimrc on docker win7

Linux 2017. 11. 30. 19:30

" tab size
set ts=4
set sw=4
set sts=4
set cindent
set smartindent

" insert mode에서 Shift Tab -> Ctrl D로 mapping (inverse indent)
inoremap <S-Tab> <C-d>

" docker terminal setting set term=cygwin



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

[Linux] hash -r 기능

Linux 2017. 11. 29. 22:27

hash is a built-in command of the bash shell

hash는 bash 쉘의 내장 커맨드이다


Remember or display program locations.

    Determine and remember the full pathname of each command NAME.  If
    no arguments are given, information about remembered commands is displayed.

hash: 캐시처럼 program location을 기억하고, 기억하고 있는 내용을 보여주는 명령어


hash -r : forget all remembered locations

기억하고 있는 모든 내용 삭제


참고: https://askubuntu.com/questions/952137/what-does-hash-r-command-do



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/

사용중인 블로그 스킨이 방명록을 지원하지 않습니다.

초대장을 받고싶으신 분들은 댓글 또는 블로그 설명의 메일로.