[server]To Update Unbuntu Server

  1. 최신 정보를 얻어오기
    [shell]$sudo apt-get update[/shell]

  2. 최신 정보로 서버를 갱신하기
    [shell]$sudo apt-get upgrade[/shell]

  3. 간혹 다음과 같은 메시지가 뜰 때가 있다.
    [shell]
    The link /vmlinuz.old is a damaged link
    Removing symbolic link vmlinuz.old
    you may need to re-run your boot loader[grub]
    The link /initrd.img.old is a damaged link
    Removing symbolic link initrd.img.old
    you may need to re-run your boot loader[grub][/shell]
    이 때
    [shell]$sudo update-grub[/shell]

[reference]
http://askubuntu.com/questions/518997/how-do-i-re-run-boot-loader

You may need to re-run your boot loader[grub]

[more info]
파일이 깨져 업데이트 에러 발생
AptGet/Howto

[ubuntu] leaking memory

[background]
1. upgrade from Ubuntu 12.04 LTS to 14.04 LTS

[problem]
1. after command ‘sudo’, the following error messages showed up.

[shell]
[sudo] password for archer:
no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory
Ignoring unknown parameter “display charset”
WARNING: Ignoring invalid value ‘lpmg’ for parameter ‘printing’
[/shell]

[solution]
1. remove the obsolete apps like this. –> it did not work.
[shell]$sudo apt-get autoremove[/shell]
2. oh, no! it’s a bug!
https://bugs.launchpad.net/ubuntu/+source/sudo/+bug/1274680
3. workaround
[shell]sudo apt-get remove libpam-smbpass[/shell]

[reference]
1. http://ubuntuforums.org/showthread.php?t=2214042
2. http://www.spinics.net/lists/samba/msg115086.html

Upgrading Apache

[과정]
학과 서버를 12.04LTS server에서 14.04LTS server로 업그레이드를 했다.

[문제]
웹서버로 접근하면 다음과 같은 문제가 발생했다.
You don’t have permission to access

[해법]
1. 웹서버 디렉토리를 다음과 같이 바꾸었다. –> 문제해결에 도움이 안 됨
[shell]chgrp -R www-data 홈페이지디렉토리[/shell]
2. 홈페이지 옵션을 Order allow, deny에서 Require all granted 로 바꾸었다.

[shell]Apache 2.2 configuration:

Order allow,deny
Allow from all

Apache 2.4 configuration:

Require all granted[/shell]

[출처]
0. http://httpd.apache.org/docs/2.4/upgrading.html
1. http://stackoverflow.com/questions/23001646/you-dont-have-permission-to-access-on-this-server-aws-ec2-ubuntu-laravel-pr
2. http://stackoverflow.com/questions/18239226/apache-error-forbidden-you-dont-have-permission-to-access-on-this-server

학과 서버 교체

1. 하드디스크 백업
2. 서버의 전원 설정 변경
– 정전이 되었다가 복원되었을 때, 다시 작동하도록 설정
-> CMOS setup에서 Power-On Options
-> After Power Loss(정전 후) (꺼짐/켜짐/이전 상태): 이 옵션을 다음과 같이 설정할 수 있습니다.
Off(꺼짐)—전원이 복구되어도 컴퓨터가 계속 꺼져 있습니다.
On(켜짐)—전원이 복구되는 즉시 자동으로 컴퓨터가 켜집니다.
On(켜짐)—컴퓨터가 전원 스트립에 연결되어 있으면 전원 스트립 스위치를 사용하여 컴퓨터를 켤 수 있습니다.
Previous state(이전 상태)—정전되었을 때 컴퓨터가 켜져 있었으면 전원이 복구되는 즉시 자동으로 컴퓨터가 켜집니다.
-> Previous state(이전 상태)로 설정함
(출처 : HP)
3. Ethenet Card 의 MAC address를 전산원에 알려줌
명령어 : ifconfig -a

[ubuntu] 디스크 복제

[문제]
학과 서버의 하드디스크를 백업한다.

[풀이]
1.부팅용 USB를 만든다 (또는 LiveCD)를 만든다.
2.새 하드디스크(기존 하드디스크보다 용량이 크거나 같아야 한다)를 준비하여, 추가한다.
3.부팅용 USB로 부팅한다.
4.두 하드디스크에 대한 정보를 확인한다.
즉 입력으로 쓸 디스크와 출력으로 쓸 디스크에 대한 정보(hard drive specs 특히 기기 위치, 제조사)를 확인해야 한다.

lshw -class disk -class storage

5.dd 명령어를 이용하여 복제한다.
다시 한 번 입력과 출력 디스크를 확인한다. 입력과 출력 디스크가 바뀌면 그야말로 큰 재앙이다.

sudo dd if=/dev/sda of=/dev/sdb

여기서 if는 input file, of는 output file

[기타]
-컴퓨터가 느려서 17MB/s 속도로 복사를 함
-속도를 높이는 블록크기는 http://superuser.com/questions/234199/good-block-size-for-disk-cloning-with-diskdump-dd

[진행상황확인]
복사가 되는 상황을 확인하는 방법은, 다른 터미널을 연 후에, 아래와 같은 명령을 입력한다.

sudo kill -USR1 $(pgrep ^dd)

[출처]
http://www.howtogeek.com/howto/19141/clone-a-hard-drive-using-an-ubuntu-live-cd/
https://wiki.archlinux.org/index.php/Disk_Cloning

6 Examples to Backup Linux Using dd Command (Including Disk to Disk)

PHP and Zend Optimizer

옛날 강의게시판이 technote(ver. 6.9로 되어 있다.
최근에 xe(1.4.5.10)로 모두 바꾸었다. 그러나, 옛 강의게시판을 그대로 유지하고 있었다.
문제는 운영체제(ubuntu)를 최신으로(9.04에서 11.10으로) 변경하면서 발생했다. 상황을 요약하면 다음과 같다.

사용자 삽입 이미지
– 테크노트는 zend optimizer가 있어야 작동한다.
– zend optimizer는 php 5.2 이하에서 작동한다.
– ubuntu 11.10에는 php 5.3.6이 설치되어 있다.
– 고로 ubuntu 11.10에서는 테크노트가 전혀 작동이 되지 않는다.
– php 버전을 내려야 문제가 해결된다.

위 사항을 알아내는 데에 많은 시간이 걸렸다.(ㅠ.ㅠ)
– php 다운그레이드를 위해 ubuntu 포럼 페이지를 참고했다.

Ubuntu 업그레이드

서버의 운영체제를 업그레이드했다.
– 기존의 운영체제 : Ubuntu 9.04 (일명 Jaunty)
– 보안문제가 대두됨 (전산원)
– 운영체제를 업그레이드하기로 함
[shell]sudo aptitude install update-manager-core
sudo do-release-upgrade[/shell]
– /boot 파티션의 공간이 부족하다는 오류 메시지가 뜸
– 현재 파티션 상황
[vim]/dev/sda1   /boot
/dev/sda2    /
/dev/sda3    swap
/dev/sda4    Extended
/dev/sda5    /home[/vim]
– /boot내용 옮기기
[shell]sudo mkdir /boot-new
sudo rsync -axS –exclude=’/*/.gvfs’ /boot/. /boot-new/.[/shell]
– 기존의 /boot파티션을 /파티션으로 옮기기로 함
– 부팅가능한 파티션을 /boot파티션에서 /로 변경함 (->여기서 bootable 여부를 설정함)
[shell]sudo fdisk /dev/sda[/shell]
– /etc/fstab의 내용을 변경함(-> /boot 부분을 주석처리함)
[shell]sudo vi /etc/fstab [/shell]
– 새로운 파티션으로 부팅함

– 9.04에서 9.10으로 업그레이드는 네트워크로 바로 안 되기 때문에 “Upgrades via alternate CD“방법을 사용함 (Jaunty to Karmic)
– 9.10은 이제 오래된 버전이어서 Ubuntu 9.10 (Karmic Koala) 페이지에서 이미지를 내려 받았음
[shell]wget http://old-releases.ubuntu.com/releases/karmic/ubuntu-9.10-server-i386.iso[/shell]
– 내려받은 이미지를 이용해서 업그레이드를 실시함( Server/Command line Upgrade)
[shell]mkdir /mnt/alternate
sudo mount -o loop /home/archer/ubuntu-9.10-server-i386.iso /mnt/alternate
cd /mnt/alternate
sudo ./cdromupgrade –frontend=DistUpgradeViewText[/shell]

– 9.10에서 10.XX로 업그레이드도 실시함(Network upgrades)
[shell]sudo aptitude install update-manager-core
sudo do-release-upgrade[/shell]

-위와 같은 네트워크 업그레이드가 안 되는 경우에는 Upgrade via alternate CD를 통해서 진행함.
– 최종적으로 현재 Ubuntu 11.10까지 업그레이드를 실시함.

Ubuntu Server에 원격접속시(SSH) 한글이 되도록 하는 법

1) 한글설치
[shell]$sudo locale-gen ko_KR.UTF-8[/shell]
2) /etc/environment 파일 편집
[shell]$sudo vi /etc/environment[/shell]
[plain]LANG=”ko_KR.UTF-8″ <– 추가[/plain]
3) /etc/profile 파일 편집
[shell]$sudo vi /etc/profile[/shell]
[plain]LANG=”ko_KR.UTF-8″<–추가[/plain]
4) 사용자(여기서는 root)의 프로파일(/root/.profile) 편집
[shell]$sudo vi /root/.profile[/shell]
[plain]# LANG=C <– 주석처리

LANGUAGE=C[/plain]

위의 두 곳을 주석처리(#)

우분투(Ubuntu)로 갈아타다

사용자 삽입 이미지학과 웹서버에 이어 드디어 본 사이트의 웹서버를 위한 운영체제를 우분투로 바꾸었다.
기존에는 한컴리눅스를 사용하였으나, 업그레이드가 쉽지 않았다.
우분투는 업그레이드가 쉬워서 바꾸기로 했다.

우분투의 철학이 맘에 들어 아래와 같이 인용해본다.

The Ubuntu promise

  • Ubuntu will always be free of charge, including enterprise releases and security updates.
  • Ubuntu comes with full commercial support from Canonical and hundreds of companies around the world.
  • Ubuntu includes the very best translations and accessibility infrastructure that the free software community has to offer.
  • Ubuntu CDs contain only free software applications; we encourage
    you to use free and open source software, improve it and pass it on.