2016년 2월 20일 토요일

Ubuntu

SSH server install

Intsall

sudo apt-get install openssh-server
sudo netstat -anp | grep LISTEN | grep sshd

Port Changing

sudo vim /etc/ssh/sshd_config 
# Port 22
Port 9022
sudo service ssh restart

참고 논문 및 사이트

1. [우분투] SSH Server 설치하기 - http://neoguru.tistory.com/57

2016년 2월 16일 화요일

RaspberryPi - 05

Printer Drive Setting

Change Samba Config

sudo vim /etc/samba/smb.conf
########## Printing ##########

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
  load printers = yes

# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap

# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
  printing = cups
  printcap name = cups

[프린터명]
  comment = 프린터명
  browseable = yes
  path = /tmp
  printable = yes
  guest ok = yes
  read only = no
  create mask = 0700

[print$]
  comment = Printer Drivers
  path = /var/lib/samba/printers
  browseable = yes
  read only = yes
  guest ok = yes
sudo /etc/init.d/samba restart

Cups Install

sudo apt-get install cups
sudo usermod -a -G lpadmin pi
sudo vim /etc/cups/cupsd.conf 
Listen *:631
WebInterface Yes #웹 인터페이스를 제공합니다.

#웹 설정 페이지의 메인화면 접속 관련 설정입니다.

  Order allow,deny
  Allow all


#설정 페이지 중 직접 설정을 바꿀 수 있는 관리자 페이지 관련 설정입니다.
#시스템 내의 유저 계정으로 접속할 수 있도록 합니다.
#서브넷 상의 pc만 접근할 수 있도록 합니다.

  Order deny,allow
  Allow all


  Order deny,allow
  Allow all
  AuthType Default
  Require user @SYSTEM


sudo /etc/init.d/cups restart

참고 논문 및 사이트

1.라즈비안(데비안) 서버에 usb 프린터 연결하기 - http://dovetail.tistory.com/29

2.라즈베리 파이에 프린터 설치하기 1 - http://flankerd.tistory.com/entry/%EB%9D%BC%EC%A6%88%EB%B2%A0%EB%A6%AC-%ED%8C%8C%EC%9D%B4%EC%97%90-%ED%94%84%EB%A6%B0%ED%84%B0-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0-1

RaspberryPi - 04

File Share Server

Samba?

RaspberryPi Server로 구동시켰던 가장 큰 이유는 프린터 서버를 위해서였다. 어떻게 하면 설치를 할 수 있을까 찾아보다보니 리눅스와 윈도우간 파일 공유를 위한 것이 있는 것을 알게되었다. 삼바는 SMB(Server Message Block)/CIFS(Common Internet File System)라는 프로토콜을 이용하고 있다. 해당 프로토콜이 리눅스와 윈도우간 파일 공유를 할 수 있도록 도와주고 있다.

Install Samba

sudo apt-get install samba samba-common samba-common-bin
sudo /etc/init.d/samba start
sudo /etc/init.d/samba stop
sudo /etc/init.d/samba restart

Add Share option at samba

sudo vim /etc/samba/smb.conf

Modify Home : read only no

Modify Home : create mask 777, directory mask 777

Add : External Folder Setting

#Modify
[homes]
...
read only = no

create mask = 0770

directory mask = 0770
...

# Add 
[External]
comment = External Hard Disk Driver Path
path = /local
read only = no
valid user = pi
browseable = yes
create mask = 0770
directory mask = 0770

Add samba user

sudo smbpasswd -a francis
New SMB password:
Retype new SMB password:
Added user francis.

리눅스에 등록하려고 하는 유저가 없다면 오류가 발생한다. Failed to add entry for user samba.

Linux Add User

계정확인

cat /etc/passwd | grep francis

계정생성

sudo useradd francis

비밀번호 변경

sudo passwd francis

참고 논문 및 사이트

1.라즈베리파이 삼바로 파일공유 설정 - http://dovetail.tistory.com/28

2.제목 : 삼바(SAMBA)서버 사용법 - https://www.linux.co.kr/home/lecture/?leccode=10644

3.리눅스 계정 생성 useradd - http://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_%EA%B3%84%EC%A0%95_%EC%83%9D%EC%84%B1_useradd

Nginx - 03

Setting Password

Apache Util

sudo apt-get install apache2-utils
sudo apt-get install apache2-utils

Create Password

mkdir /local/link/nginx/passwd

생성

sudo htpasswd -c /local/link/nginx/passwd/.htpasswd francis

New password: 
Re-type new password: 
Adding password for user francis

추가

sudo htpasswd /local/link/nginx/passwd/.htpasswd

Nginx Setting

auth_basic "Restricted";
auth_basic_user_file /local/link/nginx/passwd/.htpasswd;

참고 논문 및 사이트

1. NginX 웹페이지에 비밀번호 ( 보안 ) 설정하기 - http://www.tutorialbook.co.kr/entry/NginX-%EC%9B%B9%ED%8E%98%EC%9D%B4%EC%A7%80%EC%97%90-%EB%B9%84%EB%B0%80%EB%B2%88%ED%98%B8-%EB%B3%B4%EC%95%88-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0

2016년 2월 13일 토요일

Nginx - 02

Config Setting

Find nginx config

sudo find / -name nginx.conf

Linking Folder

 ln -s /usr/local/nginx /local/nginx

-s : 심볼릭링크를 생성. ( 없으면 하드링크 생성)

Config Description

- worker_process 1 : Process 개수가 한 개. (cf. CPU 코어 개수만큼 할당)

- worker_connections 1024 : Process가 동시 접속 처리가 1024개.

- keepalive_timeout 65 : 클라이언트 접속 유지시간

참고 논문 및 사이트

1. NGINX 환경설정 - https://opentutorials.org/module/384/4526

2. [LINUX] 심볼릭 링크 & 하드 링크 - http://egloos.zum.com/sunnmoon/v/1858692

3. Nginx HTTP Server - 3. 환경설정 - http://ohgyun.com/479

4. Nginx Report v1.1 - http://egloos.zum.com/edendev/v/3257937

Nginx - 01

Ngnix Install

Download

Nginx Download Homepage
wget http://nginx.org/download/nginx-1.8.1.tar.gz
tar -xvzf nginx-1.8.1.tar.gz 
Prce Directory Homepage
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
tar -xvzf pcre-8.38.tar.gz
Open ssl
wget http://www.openssl.org/source/openssl-1.0.2f.tar.gz
tar -xzvf openssl-1.0.2f.tar.gz;
Zlib
wget http://zlib.net/zlib128.zip
unzip zlib128.zip

Install

sudo ./configure --with-zlib=../zlib-1.2.8 --with-pcre=../pcre-8.38 --with-openssl=../openssl-1.0.2f --with-http_ssl_module --with-debug --prefix=/usr/local/nginx --user=www-data --group=www-data
sudo make
sudo make install
sudo /usr/local/nginx/sbin/nginx
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx -s reload

Raspberry pi not working

sudo wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx -O /etc/init.d/nginx;
sudo chmod +x /etc/init.d/nginx;
sudo update-rc.d -f nginx defaults
service nginx start : 시작 
service nginx stop : 정지
service nginx restart : 재시작
service nginx reload : 설정파일을 재로드
service nginx status : 현재 상태 

참고 논문 및 사이트

1. NGINX 컴파일 - https://opentutorials.org/module/384/4511

RaspberryPi - 03

Root Storage

파티션 리스트 확인

SD Card 가 16G 임에도 4G만 잡혀있는것올 확인할 수 있다.

sudo fdisk -l

파티션 수정

sudo fdisk -u -c /dev/mmcblk0

파티션 리스트 확인

Command (m for help) : p
/dev/mmbcblk0p1
/dev/mmbcblk0p2 122880 
Command (m for help) : d
Partition number(1-4) : 2
Command (m for help) : n
Select (default p) : p
Partition number(1-4, default 2) : 2
First sector : 122880
Last sector : (etner)
Command (m for help) : w
sudo reboot -h now
sudo resize2fs /dev/mmcblk0p2
sudo df -h

참고 논문 및 사이트

1. 라즈베리파이 파티션 용량 늘리기 - http://zelits.tistory.com/65