"Linux"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
잔글
 
(사용자 3명의 중간 판 70개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==== 한글 나오게 하기 ====
+
=== <code>-bash: warning: setlocale: LC_ALL: cannot change locale (ko_KR.UTF-8)</code> ===
 +
sudo vim /etc/locale.gen # uncomment ko_KR.UTF-8 line.
 +
sudo locale-gen
 +
# logout and re-login
 +
 
 +
=== 한글 나오게 하기 ===
  
 
<code>.bashrc</code>에 <code>export LANG=ko_KR.UTF-8</code>
 
<code>.bashrc</code>에 <code>export LANG=ko_KR.UTF-8</code>
8번째 줄: 13번째 줄:
 
# fc-cache
 
# fc-cache
 
# chmod -R a+r /usr/share/fonts/msfont</source> 이렇게 하면 됨. 글꼴파일 이름이 한글이어도 정상동작했고 firefox에서 자동으로 인식했음. 터미널에는 글꼴 없어도 export LANG만 가지고도 됨.[http://blog.nice2seeyou.com/mike/tag/%ED%95%9C%EA%B8%80%ED%8F%B0%ED%8A%B8 여기]참고했음. 나는 fonts.dir, fonts.cache-1같은것이 생기지 않았기 때문에 저 중에 무언가를 빼도 될것같기도 함.
 
# chmod -R a+r /usr/share/fonts/msfont</source> 이렇게 하면 됨. 글꼴파일 이름이 한글이어도 정상동작했고 firefox에서 자동으로 인식했음. 터미널에는 글꼴 없어도 export LANG만 가지고도 됨.[http://blog.nice2seeyou.com/mike/tag/%ED%95%9C%EA%B8%80%ED%8F%B0%ED%8A%B8 여기]참고했음. 나는 fonts.dir, fonts.cache-1같은것이 생기지 않았기 때문에 저 중에 무언가를 빼도 될것같기도 함.
 +
 +
=== gcc설치 ===
 +
<code>yum groupinstall 'Development Tools'</code>
 +
 +
 +
 +
===selinux===
 +
* see /etc/sysconfig/iptables (if you cannot access port 80 at remote place)
 +
*# Modify that file or
 +
*# Use the <code>system-config-firewall</code> command
 +
*# if this is not a problem, see this [http://wiki.centos.org/HowTos/SELinux#head-ad837f60830442ae77a81aedd10c20305a811388 CentOS wiki page]
 +
*#* <code> semanage port -a -t http_port_t -p tcp 81</code>
 +
* Use <code>setenforce</code> command  instead of <code> echo 0 > /selinux/enforce </code> (Because just simple. no other reasons)
 +
* <code>ls -Z</code>
 +
* <code>ps -ZC httpd</code>
 +
** or <code>ps -eZ</code>
 +
 +
 +
 +
==Base64 decode to file==
 +
<pre>perl -MMIME::Base64 -ne 'print decode_base64($_)' < file.txt > out</pre>
 +
http://wvarner.blogspot.com/2008/06/base64-decode-to-file.html
 +
 +
==core file==
 +
cat /proc/sys/kernel/core_pattern
 +
https://superuser.com/questions/849099/where-does-ubuntu-14-04-drop-core-files
 +
 +
==network issues==
 +
 +
===gateway ip===
 +
<pre> $ route -n
 +
$ netstat -r -n
 +
$ ip route show </pre>
 +
gateway가 아예 안나올 때(via ~가 보이지 않는다거나 route에서 gateway가 *.*.*.*)가 있던데 이건 어떤 경우인지 모르겠다.<br>
 +
[https://www.cyberciti.biz/faq/how-to-find-gateway-ip-address/ www.cyberciti.biz]
 +
 +
===<code>ip route</code> examples===
 +
<pre> ip route add 192.168.1.0/24 dev eth0
 +
ip route add default via 192.168.1.254
 +
ip route delete 192.168.1.0/24 dev eth0</pre>
 +
[https://www.cyberciti.biz/faq/howto-linux-configuring-default-route-with-ipcommand/ www.cyberciti.biz]
 +
 +
===ip collision detect : <code>arp-scan</code>===
 +
<pre>$ sudo apt-get install arp-scan
 +
$ arp-scan -I eth0 -l | grep 192.168.1.42
 +
192.168.1.42 d4:eb:9a:f2:11:a1 (Unknown)
 +
192.168.1.42 f4:23:a4:38:b5:76 (Unknown) (DUP: 2)</pre>
 +
[http://askubuntu.com/questions/30080/how-to-solve-connection-refused-errors-in-ssh-connection/141415#141415 askubuntu.com]
 +
 +
===When <code>ifdown</code> is not working===
 +
$ sudo ifconfig eth0 down
 +
http://unix.stackexchange.com/a/50604/31363
 +
 +
===flushing interface===
 +
ip addr flush dev enp2s0
 +
http://askubuntu.com/a/875180/400331
 +
 +
===Set DNS manually===
 +
<pre>/etc/resolvconf/resolv.conf.d/base</pre>
 +
<pre>nameserver 8.8.8.8
 +
nameserver 8.8.4.4</pre>
 +
<pre>sudo resolvconf -u</pre>
 +
[https://askubuntu.com/a/662865 askubuntu.com]
 +
 +
===add static routes in Ubuntu===
 +
# vi /etc/network/interfaces
 +
...
 +
up ip route add 192.168.0.0/24
 +
https://askubuntu.com/a/168037/400331
 +
 +
===Flushing dhcp===
 +
dhclient -r
 +
https://askubuntu.com/q/151958/400331
 +
 +
===network configuration examples (ubuntu)===
 +
[https://help.ubuntu.com/community/NetworkConfigurationCommandLine/Automatic help.ubuntu.com]
 +
* Setting/changing the hostname
 +
* Finding your network interface
 +
* Disable network managers and/or wicd
 +
* Configuring an interface
 +
* Setting up a second IP address or Virtual IP address
 +
* Howto set MTU for a connection
 +
* Setting up DNS
 +
* Wireless
 +
etc
 +
 +
==ssh==
 +
===ssh alias===
 +
edit <code>~/.ssh/config</code>
 +
<pre>Host myremote            # any name for the host
 +
HostName 192.168.178.05  # IP, .local, or hostname if defined
 +
User username            # your username
 +
Port 22                  # port to listen</pre>
 +
and then,
 +
<code>ssh myremote</code><br>
 +
http://askubuntu.com/questions/257472/host-alias-for-ssh askubuntu.com
 +
 +
===sshd restart===
 +
# sudo service ssh restart
 +
or
 +
# /etc/init.d/ssh restart
 +
https://www.cyberciti.biz/faq/howto-restart-ssh/
 +
 +
===centos 7 sshd service not found===
 +
systemctl enable sshd.service
 +
systemctl start sshd.service
 +
systemctl status sshd.service
 +
https://www.digitalocean.com/community/questions/centos-7-sshd-service-not-found
 +
 +
==kill x-server (stop lightdm)==
 +
ctrl + alt + F1 : to switch terminal.
 +
cf) ctrl+alt+F7 to switch x-window
 +
<pre>sudo service lightdm stop</pre>
 +
or
 +
<pre>sudo /etc/init.d/lightdm stop
 +
# or
 +
sudo service lightdm stop
 +
# lightdm can be known by this.
 +
cat /etc/X11/default-display-manager</pre>
 +
[http://askubuntu.com/a/320670 askubuntu.com] [http://askubuntu.com/a/295786 askubuntu.com][http://askubuntu.com/a/1222 askubuntu.com]
 +
 +
==“Required key not available” when install 3rd party kernel modules==
 +
or after a kernel upgrade.<br>
 +
To resolve this, disable Secure Boot in UEFI(BIOS) settings.
 +
<br>[http://askubuntu.com/a/762255 askubuntu.com]
 +
 +
==my Ubuntu version==
 +
<pre>lsb_release -a</pre>
 +
[https://help.ubuntu.com/community/CheckingYourUbuntuVersion help.ubuntu.com]
 +
 +
==symbolic link의 chown==
 +
<code>-h</code> 옵션을 같이 쓸 것. no dereference option.
 +
 +
https://superuser.com/a/68688
 +
 +
==sudo without password==
 +
sudo visudo
 +
In the bottom of the file, type the follow:
 +
username ALL=(ALL) NOPASSWD: ALL
 +
https://askubuntu.com/a/147265/400331
 +
 +
==Upgrade single package==
 +
apt-get install --only-upgrade <packagename>
 +
https://askubuntu.com/a/44124/400331
 +
 +
==boot partition full==
 +
먼저, 쓸데없이 설치되어 있는 커널 찾아본다.
 +
<nowiki>sudo dpkg --list 'linux-image*' | grep ^ii | awk '{print $2}' | sort | egrep "[0-9]-generic" | head -n -3</nowiki>
 +
([https://askubuntu.com/a/345611 여기]의 세번째 댓글이 출처)<br>
 +
내 현재 커널과(<c>uname -r</c>)상관 없으면 다 쓸데없는 커널이미지.
 +
 +
그 다음, 지운다. 잘 안되면, 강제로 한다.
 +
sudo dpkg --remove --force-remove-reinstreq <packagename>
 +
[https://askubuntu.com/a/751580/400331]<br>
 +
dependency가 있으면 어떤 패키지부터 지우라고 알려준다. 현재 커널과 상관없으면 다 지워도 된다.
 +
 +
기도하면서 재부팅.
 +
 +
 +
=temporary ssh/rsync server=
 +
<p>가장 쉬운 방법은, 한쪽에서</p>
 +
<p><code>/sbin/sshd -p 6789</code></p>
 +
<p>하고, 다른쪽에서 그 포트로 접속하는 것.
 +
rsync도 해당 포트를 이용해서 하는 것이 가장 빠르다.</p>
 +
<p><code>rsync -e &#39;ssh -P 6789&#39; user@1.2.3.4:path/to</code></p>
 +
[https://www.tecmint.com/sync-files-using-rsync-with-non-standard-ssh-port/ How to Rsync with non-standard SSH Port]
 +
 +
=ssh ternnel=
 +
<p>터널링에 관한 자료들</p>
 +
<ul>
 +
<li>[https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html Local and Remote Port Forwarding Explained With Examples]</li>
 +
<li>[https://serverfault.com/questions/337274/ssh-from-a-through-b-to-c-using-private-key-on-b SSH from A through B to C, using private key on B]</li>
 +
<li>[https://www.techrepublic.com/article/how-to-use-local-and-remote-ssh-port-forwarding/ How to use local and remote SSH port forwarding]
 +
</ul>
 +
<p>&nbsp;</p>
 +
 +
==discussion==
 +
<disqus></disqus>

2018년 10월 31일 (수) 17:47 기준 최신판

-bash: warning: setlocale: LC_ALL: cannot change locale (ko_KR.UTF-8)

sudo vim /etc/locale.gen # uncomment ko_KR.UTF-8 line.
sudo locale-gen 
# logout and re-login

한글 나오게 하기

.bashrcexport LANG=ko_KR.UTF-8

X에 한글글꼴이 없을 수 있음. 그러면 윈도우에 글꼴 몇개 가져다가/usr/share/fonts/ms/에 넣고

# cd /usr/share/fonts/ms
# mkfontscale
# ttmkfdir
# fc-cache
# chmod -R a+r /usr/share/fonts/msfont

이렇게 하면 됨. 글꼴파일 이름이 한글이어도 정상동작했고 firefox에서 자동으로 인식했음. 터미널에는 글꼴 없어도 export LANG만 가지고도 됨.여기참고했음. 나는 fonts.dir, fonts.cache-1같은것이 생기지 않았기 때문에 저 중에 무언가를 빼도 될것같기도 함.

gcc설치

yum groupinstall 'Development Tools'


selinux

  • see /etc/sysconfig/iptables (if you cannot access port 80 at remote place)
    1. Modify that file or
    2. Use the system-config-firewall command
    3. if this is not a problem, see this CentOS wiki page
      • semanage port -a -t http_port_t -p tcp 81
  • Use setenforce command instead of echo 0 > /selinux/enforce (Because just simple. no other reasons)
  • ls -Z
  • ps -ZC httpd
    • or ps -eZ


Base64 decode to file

perl -MMIME::Base64 -ne 'print decode_base64($_)' < file.txt > out

http://wvarner.blogspot.com/2008/06/base64-decode-to-file.html

core file

cat /proc/sys/kernel/core_pattern

https://superuser.com/questions/849099/where-does-ubuntu-14-04-drop-core-files

network issues

gateway ip

 $ route -n
 $ netstat -r -n
 $ ip route show 

gateway가 아예 안나올 때(via ~가 보이지 않는다거나 route에서 gateway가 *.*.*.*)가 있던데 이건 어떤 경우인지 모르겠다.
www.cyberciti.biz

ip route examples

 ip route add 192.168.1.0/24 dev eth0
 ip route add default via 192.168.1.254
 ip route delete 192.168.1.0/24 dev eth0

www.cyberciti.biz

ip collision detect : arp-scan

$ sudo apt-get install arp-scan
$ arp-scan -I eth0 -l | grep 192.168.1.42
 192.168.1.42 d4:eb:9a:f2:11:a1 (Unknown)
 192.168.1.42 f4:23:a4:38:b5:76 (Unknown) (DUP: 2)

askubuntu.com

When ifdown is not working

$ sudo ifconfig eth0 down

http://unix.stackexchange.com/a/50604/31363

flushing interface

ip addr flush dev enp2s0

http://askubuntu.com/a/875180/400331

Set DNS manually

/etc/resolvconf/resolv.conf.d/base
nameserver 8.8.8.8
nameserver 8.8.4.4
sudo resolvconf -u

askubuntu.com

add static routes in Ubuntu

# vi /etc/network/interfaces
...
up ip route add 192.168.0.0/24 

https://askubuntu.com/a/168037/400331

Flushing dhcp

dhclient -r

https://askubuntu.com/q/151958/400331

network configuration examples (ubuntu)

help.ubuntu.com

  • Setting/changing the hostname
  • Finding your network interface
  • Disable network managers and/or wicd
  • Configuring an interface
  • Setting up a second IP address or Virtual IP address
  • Howto set MTU for a connection
  • Setting up DNS
  • Wireless

etc

ssh

ssh alias

edit ~/.ssh/config

Host myremote             # any name for the host
HostName 192.168.178.05   # IP, .local, or hostname if defined
User username             # your username
Port 22                   # port to listen

and then, ssh myremote
http://askubuntu.com/questions/257472/host-alias-for-ssh askubuntu.com

sshd restart

# sudo service ssh restart

or

# /etc/init.d/ssh restart

https://www.cyberciti.biz/faq/howto-restart-ssh/

centos 7 sshd service not found

systemctl enable sshd.service
systemctl start sshd.service
systemctl status sshd.service

https://www.digitalocean.com/community/questions/centos-7-sshd-service-not-found

kill x-server (stop lightdm)

ctrl + alt + F1 : to switch terminal. cf) ctrl+alt+F7 to switch x-window

sudo service lightdm stop

or

sudo /etc/init.d/lightdm stop 
# or 
sudo service lightdm stop
# lightdm can be known by this.
cat /etc/X11/default-display-manager

askubuntu.com askubuntu.comaskubuntu.com

“Required key not available” when install 3rd party kernel modules

or after a kernel upgrade.
To resolve this, disable Secure Boot in UEFI(BIOS) settings.
askubuntu.com

my Ubuntu version

lsb_release -a

help.ubuntu.com

symbolic link의 chown

-h 옵션을 같이 쓸 것. no dereference option.

https://superuser.com/a/68688

sudo without password

sudo visudo

In the bottom of the file, type the follow:

username ALL=(ALL) NOPASSWD: ALL

https://askubuntu.com/a/147265/400331

Upgrade single package

apt-get install --only-upgrade <packagename>

https://askubuntu.com/a/44124/400331

boot partition full

먼저, 쓸데없이 설치되어 있는 커널 찾아본다.

sudo dpkg --list 'linux-image*' | grep ^ii | awk '{print $2}' | sort | egrep "[0-9]-generic" | head -n -3

(여기의 세번째 댓글이 출처)
내 현재 커널과(uname -r)상관 없으면 다 쓸데없는 커널이미지.

그 다음, 지운다. 잘 안되면, 강제로 한다.

sudo dpkg --remove --force-remove-reinstreq <packagename>

[1]
dependency가 있으면 어떤 패키지부터 지우라고 알려준다. 현재 커널과 상관없으면 다 지워도 된다.

기도하면서 재부팅.


temporary ssh/rsync server

가장 쉬운 방법은, 한쪽에서

/sbin/sshd -p 6789

하고, 다른쪽에서 그 포트로 접속하는 것. rsync도 해당 포트를 이용해서 하는 것이 가장 빠르다.

rsync -e 'ssh -P 6789' user@1.2.3.4:path/to

How to Rsync with non-standard SSH Port

ssh ternnel

터널링에 관한 자료들

 

discussion

blog comments powered by Disqus