우분투 preseed 예제

Posted by !kKo geek_stuff/server & linux : 2013.10.22 17:43

# Ubuntu Server Quick Install

# by Dustin Kirkland <kirkland@ubuntu.com>

#  * Documentation: http://bit.ly/uquick-doc

# modified by ikko


################################################################################

### Localization                                                             ###

################################################################################

d-i     debian-installer/locale string en_US.UTF-8

d-i     debian-installer/splash boolean false

d-i     console-setup/ask_detect        boolean false

d-i     console-setup/layoutcode        string us

d-i     console-setup/variantcode       string 


################################################################################

### Network configuration                                                    ###

################################################################################

d-i     netcfg/choose_interface select eth0

d-i     netcfg/get_nameservers  string 

d-i     netcfg/get_ipaddress    string 

d-i     netcfg/get_netmask      string 255.255.255.0

d-i     netcfg/get_gateway      string 

d-i     netcfg/confirm_static   boolean true


################################################################################

### Mirror settings                                                          ###

################################################################################

# If you select ftp, the mirror/country string does not need to be set

d-i     mirror/country string manual

d-i     mirror/protocol string http

d-i     mirror/http/hostname string ftp.daum.net

d-i     mirror/http/directory string /ubuntu

d-i     mirror/http/proxy string


# FTP mirror configuration

#d-i    mirror/protocol string ftp

#d-i    mirror/ftp/hostname string mirror.home.lan

#d-i    mirror/ftp/directory string /pub/linux/ubuntu

#d-i    mirror/ftp/proxy string


# Alternatively: by default, the installer uses CC.archive.ubuntu.com where

# CC is the ISO-3166-2 code for the selected country. You can preseed this

# so that it does so without asking.

#d-i    mirror/http/mirror select CC.archive.ubuntu.com

#d-i    mirror/http/mirror select kr.archive.ubuntu.com


################################################################################

### Partitioning                                                             ###

################################################################################

# If the system has free space you can choose to only partition that space.

# This is only honoured if partman-auto/method (below) is not set.

# Alternatives: custom, some_device, some_device_crypto, some_device_lvm.

#d-i partman-auto/init_automatically_partition select biggest_free


# Alternatively, you may specify a disk to partition. If the system has only

# one disk the installer will default to using that, but otherwise the device

# name must be given in traditional, non-devfs format (so e.g. /dev/hda or

# /dev/sda, and not e.g. /dev/discs/disc0/disc).

d-i     partman-auto/disk string /dev/sda


# In addition, you'll need to specify the method to use.

# The presently available methods are:

# - regular: use the usual partition types for your architecture

# - lvm:     use LVM to partition the disk

# - crypto:  use LVM within an encrypted partition

d-i     partman-auto/method string regular


# If one of the disks that are going to be automatically partitioned

# contains an old LVM configuration, the user will normally receive a

# warning. This can be preseeded away...

d-i     partman-lvm/device_remove_lvm boolean true

# The same applies to pre-existing software RAID array:

d-i     partman-lvm/device_remove_md boolean true

# And the same goes for the confirmation to write the lvm partitions.

d-i     partman-lvm/confirm boolean true


## Partitioning using LVM


# For LVM partitioning, you can select how much of the volume group to use

# for logical volumes.

#d-i partman-auto-lvm/guided_size string max

#d-i partman-auto-lvm/guided_size string 10GB

#d-i partman-auto-lvm/guided_size string 50%


# You can choose one of the three predefined partitioning recipes:

# - atomic: all files in one partition

# - home:   separate /home partition

# - multi:  separate /home, /usr, /var, and /tmp partitions

d-i     partman-auto/choose_recipe select atomic


# Or provide a recipe of your own...

# If you have a way to get a recipe file into the d-i environment, you can

# just point at it.

#d-i partman-auto/expert_recipe_file string /hd-media/recipe


# If not, you can put an entire recipe into the preconfiguration file in one

# (logical) line. This example creates a small /boot partition, suitable

# swap, and uses the rest of the space for the root partition:

#d-i partman-auto/expert_recipe string            \

#    boot-root ::                                 \

#        40 50 100 ext3                           \

#            $primary{ } $bootable{ }             \

#            method{ format } format{ }           \

#            use_filesystem{ } filesystem{ ext3 } \

#            mountpoint{ /boot }                  \

#        .                                        \

#        500 10000 1000000000 ext3                \

#            method{ format } format{ }           \

#            use_filesystem{ } filesystem{ ext3 } \

#            mountpoint{ / }                      \

#        .                                        \

#        64 512 300% linux-swap                   \

#            method{ swap } format{ }             \

#        .


# The full recipe format is documented in the file partman-auto-recipe.txt

# included in the 'debian-installer' package or available from D-I source

# repository. This also documents how to specify settings such as file

# system labels, volume group names and which physical devices to include

# in a volume group.


# This makes partman automatically partition without confirmation, provided

# that you told it what to do using one of the methods above.

d-i     partman/confirm_write_new_label boolean true

d-i     partman/choose_partition        select Finish partitioning and write changes to disk

d-i     partman/confirm boolean true

d-i     partman/confirm_nooverwrite boolean true

d-i     partman/default_filesystem string ext4


################################################################################

### Clock and time zone setup                                                ###

################################################################################

# Controls whether or not the hardware clock is set to UTC.

d-i     clock-setup/utc boolean true

d-i     clock-time/zone string Asia/Seoul

d-i     clock-setup/ntp boolean true

d-i     clock-setup/ntp-server  string 0.pool.ntp.org

d-i     base-installer/kernel/image     string linux-server

d-i     passwd/root-login       boolean true

d-i     passwd/root-password password p@ssw0rd

d-i     passwd/root-password-again password p@ssw0rd

d-i     passwd/make-user        boolean true

d-i     passwd/user-fullname    string eats

d-i     passwd/username string ikko

d-i     passwd/user-password password p@ssw0rd

d-i     passwd/user-password-again password p@ssw0rd

#d-i     passwd/user-password-crypted    password $6$.1eHH0iY$ArGzKX2YeQ3G6U.mlOO3A.NaL22Ewgz8Fi4qqz.Ns7EMKjEJRIW2Pm/TikDptZpuu7I92frytmk5YeL.9fRY4.

d-i     passwd/user-uid string 

d-i     user-setup/allow-password-weak  boolean true

d-i     user-setup/encrypt-home boolean false

d-i     passwd/user-default-groups      string adm cdrom dialout lpadmin plugdev sambashare

d-i     apt-setup/services-select       multiselect security

d-i     apt-setup/security_host string ftp.daum.net

d-i     apt-setup/security_path string /ubuntu

d-i     debian-installer/allow_unauthenticated  string false

d-i     pkgsel/upgrade  select safe-upgrade

d-i     pkgsel/language-packs   multiselect 

d-i     pkgsel/update-policy    select none

d-i     pkgsel/updatedb boolean true

d-i     grub-installer/skip     boolean false

d-i     lilo-installer/skip     boolean false

d-i     grub-installer/only_debian      boolean true

d-i     grub-installer/with_other_os    boolean true

d-i     finish-install/keep-consoles    boolean false

d-i     finish-install/reboot_in_progress       note 

d-i     cdrom-detect/eject      boolean true

d-i     debian-installer/exit/halt      boolean false

d-i     debian-installer/exit/poweroff  boolean false

d-i     pkgsel/include string openssh-server ssh vim ntp byobu unattended-upgrades


################################################################################

### Advanced options                                                         ###

################################################################################


################################################################################

### Running custom commands during the installation                          ###

################################################################################

# d-i preseeding is inherently not secure. Nothing in the installer checks

# for attempts at buffer overflows or other exploits of the values of a

# preconfiguration file like this one. Only use preconfiguration files from

# trusted locations! To drive that home, and because it's generally useful,

# here's a way to run any shell command you'd like inside the installer,

# automatically.


# This first command is run as early as possible, just after

# preseeding is read.

#d-i preseed/early_command string anna-install some-udeb


# This command is run just before the install finishes, but when there is

# still a usable /target directory. You can chroot to /target and use it

# directly, or use the apt-install and in-target commands to easily install

# packages and run commands in the target system.

#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh

in-target touch /root/installed



apt 사용시 proxy 사용

Posted by !kKo geek_stuff/server & linux : 2012.08.06 11:12

apt 사용할 때 proxy 뒤에 있지만 local mirroring 이 존재할 때, 다음과 같은 설정을 추가하면 된다.

root@client:# vi /etc/apt.conf


Acquire::http::proxy {
    192.168.0.1 DIRECT;
    "http://192.168.0.254:3128/";
};
Acquire::https::proxy {
    192.168.0.1 DIRECT;
    "https://192.168.0.254:3128/";
};
Acquire::ftp::proxy {
    192.168.0.1 DIRECT;
    "ftp://192.168.0.254:3128/";
};
Acquire::socks::proxy {
    192.168.0.1 DIRECT;
    "socks://192.168.0.254:3128/";
};



192.168.0.1은 local mirroing server 주소 또는 실제 repository address

suffix로 DIRECT 를 추가하면 proxy를 타지 않는다.


192.168.0.254는 proxy address


세미콜론(;) 주의.

ubuntu repository mirroring

Posted by !kKo geek_stuff/server & linux : 2012.08.06 11:05

우분투 레포지토리 미러링


내부에 ubuntu 설치된 pc나 서버가 여러대일 경우 각각 하나씩 다운받는 것보다 미러링을 받는게 훨씬 빠르다.

미러링은 의외로 간단한 듯.


1. 서버에서 설정하기

일단 apt-mirror를 설치


root@server:/# apt-get install apt-mirror



이후 /etc/apt/mirror.list를 수정

i-386과 amd-64를 동시에 미러링 한다면 다음과 같이 설정


############# config ##################
#
set base_path    /backup/backupdisk1/ubuntu
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  <running host architecture>
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads     20
set _tilde 0
#
############# end config ##############

deb-amd64 http://ftp.daum.net/ubuntu precise main restricted universe multiverse
deb-amd64 http://ftp.daum.net/ubuntu precise-security main restricted universe multiverse
deb-amd64 http://ftp.daum.net/ubuntu precise-updates main restricted universe multiverse
deb-amd64 http://ftp.daum.net/ubuntu precise-proposed main restricted universe multiverse
deb-amd64 http://ftp.daum.net/ubuntu precise-backports main restricted universe multiverse

# mirror the debian-installer directories for mirroring install base (eg: mini.iso)
deb http://ftp.daum.net/ubuntu precise main main/debian-installer restricted restricted/debian-installer universe universe/debian-installer multiverse multiverse/debian-installer

deb-i386 http://ftp.daum.net/ubuntu precise main restricted universe multiverse
deb-i386 http://ftp.daum.net/ubuntu precise-security main restricted universe multiverse
deb-i386 http://ftp.daum.net/ubuntu precise-updates main restricted universe multiverse
deb-i386 http://ftp.daum.net/ubuntu precise-proposed main restricted universe multiverse
deb-i386 http://ftp.daum.net/ubuntu precise-backports main restricted universe multiverse

deb-src http://ftp.daum.net/ubuntu precise main restricted universe multiverse
deb-src http://ftp.daum.net/ubuntu precise-security main restricted universe multiverse
deb-src http://ftp.daum.net/ubuntu precise-updates main restricted universe multiverse
deb-src http://ftp.daum.net/ubuntu precise-proposed main restricted universe multiverse
deb-src http://ftp.daum.net/ubuntu precise-backports main restricted universe multiverse

clean http://ftp.daum.net/ubuntu


apt-mirror 실행


root@server:/etc/apt# apt-mirror

root@server:/etc/apt# apt-mirror
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "ko_KR.UTF-8",
    LC_ADDRESS = "ko_KR.UTF-8",
    LC_MONETARY = "ko_KR.UTF-8",
    LC_NUMERIC = "ko_KR.UTF-8",
    LC_TELEPHONE = "ko_KR.UTF-8",
    LC_IDENTIFICATION = "ko_KR.UTF-8",
    LC_MEASUREMENT = "ko_KR.UTF-8",
    LC_TIME = "ko_KR.UTF-8",
    LC_NAME = "ko_KR.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Downloading 222 index files using 20 threads...
Begin time: Mon Aug  6 10:54:08 2012
[20]... [19]... [18]... [17]... [16]... [15]... [14]... [13]... [12]... [11]... [10]... [9]... [8]... [7]... [6]... [5]... [4]... [3]... [2]... [1]... [0]...
End time: Mon Aug  6 10:54:09 2012

Proceed indexes: [SSSSSPPPPPPPPPPP]

0.0 bytes will be downloaded into archive.
Downloading 0 archive files using 0 threads...
Begin time: Mon Aug  6 10:54:20 2012
[0]...
End time: Mon Aug  6 10:54:20 2012


현재 repo 용량은 120G정도?



2. Client 에서 설정하기

/etc/apt/source.list의 host를 모두 수정한다.


deb http://archive.ubuntu.com/ubuntu/ precise main restricted

등을 모두 deb http://${server_ip}/ubuntu/ precise main restricted로 변경한다.

예를 들면 아래와 같이....

# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release i386 (20120423)]/ precise main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://192.168.0.1/ubuntu/ precise main restricted
deb-src http://192.168.0.1/ubuntu/ precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://192.168.0.1/ubuntu/ precise-updates main restricted
deb-src http://192.168.0.1/ubuntu/ precise-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://192.168.0.1/ubuntu/ precise universe
deb-src http://192.168.0.1/ubuntu/ precise universe
deb http://192.168.0.1/ubuntu/ precise-updates universe
deb-src http://192.168.0.1/ubuntu/ precise-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://192.168.0.1/ubuntu/ precise multiverse
deb-src http://192.168.0.1/ubuntu/ precise multiverse
deb http://192.168.0.1/ubuntu/ precise-updates multiverse
deb-src http://192.168.0.1/ubuntu/ precise-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://192.168.0.1/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://192.168.0.1/ubuntu/ precise-backports main restricted universe multiverse

deb http://192.168.0.1/ubuntu precise-security main restricted
deb-src http://192.168.0.1/ubuntu precise-security main restricted
deb http://192.168.0.1/ubuntu precise-security universe
deb-src http://192.168.0.1/ubuntu precise-security universe
deb http://192.168.0.1/ubuntu precise-security multiverse
deb-src http://192.168.0.1/ubuntu precise-security 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 precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
deb http://192.168.0.1/ubuntu/ precise-proposed restricted main multiverse universe


또는 스크립트를 사용할 수도...

user@client:/etc/apt# mv source.list source.list.orig; cat source.list.orig | sed "s/kr.archive.ubuntu.com/192.168.0.1/" > source.list


이후 업데이트 한번하고 설치하면 끝

user@client:/# apt-get update




GIT 이전

Posted by !kKo geek_stuff/server & linux : 2012.08.02 17:14

GIT public repository 이전


apt-get intall git git-core git-daemon


/etc/service/git-daemon 의 내용을 편집

#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugitdaemon \
  "$(git --exec-path)"/git-daemon --verbose --reuseaddr \
    --base-path=/repository/git/public --export-all --syslog --detach


레포지토리의 path를 --base-path 이후에 적어준다.


이후 기존 repository를 통째로 들고와서 --base-path 에 명시한 디렉토리에 복사.


끝~

한참 머리 굴리다가 만들었다. ㅋㅋ


windows에 ssh 서버를 설치해야 하고, (cygwin으로 하면 편한듯)

각 ssh서버들에 id_rsa.pub을 .ssh/authorized_key로 복사해 넣어야 하는 단점이 있긴 하지만...

#!/bin/bash
if [[ -z $1 ]]; then
        RUN_IN_SEC=30
else
        RUN_IN_SEC=$1
fi
PC_ADDR=( "root@172.20.31.27,linux" "ikko@172.20.31.26,windows" "root@localhost,linux" )

# Remote PC
function Run_Remote_Suspend()
{
        local variables=( `echo $@ | tr "," " "` )
        local id_address=${variables[0]}
        local pc_type=${variables[1]}

        if [[ $id_address == "root@localhost" ]]; then
                #let localhost enter suspend mode last
                sleep 10
        fi
        sleep $RUN_IN_SEC

        case $pc_type in
        [lL][iI][nN][uU][xX])
                ssh $id_address "pm-suspend"
                ;;
        [wW][iI][nN][dD][oO][wW][sS])
                # This command disables hibernation feature in windows.
                # Windows requres to install ssh server (tested with cygwin sshd)
                ssh $id_address "powercfg -hibernate off && rundll32 powrprof.dll,SetSuspendState 0,1,0"
                ;;
        esac
}

function Ask_Cancel()
{
        /usr/bin/xmessage -display 127.0.0.1:0.0 -nearmouse -buttons "Cancel:1" "System will enter sleep mode in $RUN_IN_SEC sec"
        # Yes=true, No=False=1
        if [[ $? -eq 1 ]]; then
                kill ${remote_pid[*]} > /dev/null
                notify-send -t 2 -i "system" "Canceled entering Sleep Mode" "Entering sleepmode canceled by user"
        fi
}

notify-send -t 2 -i "system" "Entering Sleep Mode" "System will enter sleep mode in $RUN_IN_SEC seconds."
for each_pc in ${PC_ADDR[*]};
do
        Run_Remote_Suspend $each_pc &
        remote_pid=( ${remote_pid[*]} $! )
done

Ask_Cancel&
let xmessage_sleep=$RUN_IN_SEC-1
sleep $xmessage_sleep && killall xmessage


/etc/pm/sleep.d/ 에서 스크립트를 만들면 아래의 경우 자동으로 해당 스크립트를 실행해준다.


hibernate

resume

thaw

suspend


예제)

#!/bin/bash

PATH=/sbin:/usr/sbin:/bin:/usr/bin
WAKEONLAN=/usr/bin/wakeonlan

if [ ! -x $WAKEONLAN ]; then
    exit 0
fi


case "${1}" in
        resume)
        wakeonlan 00:23:11:22:33:44
        wakeonlan 00:24:11:22:33:44
        ;;
    suspend|hibernate|thaw)
        # nothing
                ;;
esac


https://zignd.wordpress.com/2012/07/11/an-a-z-index-of-the-bash-command-line-for-linux/




ssh 접속이 느릴경우

Posted by !kKo geek_stuff/server & linux : 2011.08.10 14:11
When logging in, ssh daemon checks reverse DNS lookup.
so only thing you have to do is, write one line in sshd_config of server.

/etc/ssh/sshd_config:
UseDNS no

restart ssh daemon, and that's it.
아직 우분투 10.10, 10.04에는 firefox 3.x가 설치되어있다.
이미 firefox4.0 정식 출시된 상황.

업그레이드 하고자하면, 세번의 스탭만 밟으면 된다.

sudo add-apt-repository ppa:mozillateam/firefox-stable
sudo apt-get update
sudo apt-get install firefox
태그 : firefox
$vi ~/.config/user-dirs.dirs의 내용을 아래와 같이 변경

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

저장 후 아래 명령 실행
mv ~/바탕화면 ~/Desktop
mv ~/다운로드 ~/Downloads
mv ~/템플릿 ~/Templates
mv ~/공개 ~/Public
mv ~/문서 ~/Documents
mv ~/음악 ~/Music
mv ~/사진 ~/Pictures
mv ~/비디오 ~/Videos

리붓하면 끝~!
태그 : 디렉토리, 한글
 «이전 1 2 3 4 5  다음»