个人工具

UbuntuHelp:Installation/OverSSH-Light

来自Ubuntu中文

跳转至: 导航, 搜索

References


/!\ This is a light 8.04 version of OverSSH installation Guide. It's a work in progress. It maybe not mature yet and it may break your system!

enter into the system

boot from gutsy/hardy live CD or boot from another gutsy/hardy OS installed on same machine then ssh from a remote workstation or login on local machine to install

Preparing the Hard Disk

Partitioning

Use fdisk to partition your hard disk.

sudo fdisk /dev/sda

Remember to set the root partition bootable! For the rest of this instruction we assume the following partition layout. /dev/sda1 (83 Linux) - for /, /dev/sda2 (82 Linux swap) - as swap

Creating File Systems

Below is how we get our / populated with ext3.

sudo mkfs.ext3 /dev/sda1

And the same for our swap partition.

sudo mkswap /dev/sda2

The Base System

Mounting Root

sudo mkdir /mnt/ubuntu ; \
sudo mount /dev/sda1 /mnt/ubuntu

Installing the Base System with Debootstrap

first of all upgrade your working system

sudo aptitude update; sudo aptitude -y dist-upgrade 
sudo aptitude -y install debootstrap ; \
sudo debootstrap hardy /mnt/ubuntu http://archive.ubuntu.com/ubuntu

or if you had an apt-cacher server on 192.168.63.22 and na.mirror.garr.it were your fastest mirror

sudo debootstrap hardy /mnt/ubuntu/ http://192.168.63.22:3142/na.mirror.garr.it/ubuntu

Basic Configuration

Set hostname hosts fstab resolv.conf sources.list interfaces froma running 8.04 OS

sudo cp /etc/hostname /etc/hosts /etc/fstab /etc/resolv.conf /mnt/ubuntu/etc/ ;\
sudo cp /etc/apt/sources.list /mnt/ubuntu/etc/apt/ ;\
sudo cp /etc/network/interfaces /mnt/ubuntu/etc/network/  

customizing fstab with filesystems UUID

sudo vol_id /dev/sda1 | grep ID_FS_UUID ;\
sudo vol_id /dev/sda2 | grep ID_FS_UUID 

substitute sda1 whith your correct real root and sda2 whith your correct real swap partition

now put correct UUIDs in the / and swap line of /etc/fstab
sudo vim /mnt/ubuntu/etc/fstab

example /etc/fstab

proc /proc proc defaults 0 0 UUID=74be20cd-9cb5-4b7b-9ae3-5096a7667b7a / ext3 defaults,errors=remount-ro 0 1 UUID=9e9d9afc-e35b-4b6a-b2b8-7eee38dfb473 none swap sw 0 0

Enter the new environment

Before we chroot into the new environment we need to mount /proc and /dev

sudo mount -t proc none /mnt/ubuntu/proc ;\
sudo mount -o bind /dev /mnt/ubuntu/dev ;\
sudo LANG= chroot /mnt/ubuntu /bin/bash

Change the root password

It is just bad if you forget this, so just ....

sudo passwd

Create a user mark

sudo addgroup --system admin ;\
sudo useradd -m -G admin -s /bin/bash mark; \
sudo passwd mark
grant sudo-rights to admin group
sudo -i 
echo "%admin   ALL=(ALL) ALL" >> /etc/sudoers
visudo

verify last line than exit from visudo without other changes

and switch shadow password on

sudo dpkg-reconfigure --default-priority passwd

Installing Packages

first of all upgrade your NEW system

sudo aptitude update; sudo aptitude -y dist-upgrade 

Installing OpenSSH Server

sudo apt-get install ssh

Install a Kernel

Choose the right kernel for your architecture. I go with:

sudo apt-get install linux

Install GRUB

sudo apt-get install grub ;\
sudo mkdir /boot/grub ;\
sudo cp /usr/lib/grub/i386-pc/* /boot/grub ;\
sudo update-grub

type y on question /!\ Due to a bug that seems affect update-grub sometimes the /boot/grub/menu.lst contains wrong reference to kernel version and/or partition. E.G. (hd0,0) instead of (hd1,3). Verify it with

sudo vi /boot/grub/menu.lst

install grub in the master boot record

sudo grub

hint: using double <TAB> KEY-presssing for completione after typing "root (hd" and "setup (hd" you ca also view partitions and after "root (hd0,0)/boot/" you can also list /boot/ files

grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Reboot

exit
cd /
sudo umount /mnt/ubuntu/proc ; \
sudo umount /mnt/ubuntu/dev ; \ 
sudo umount /mnt/ubuntu ; \
sudo reboot

Finishing

After the reboot ssh as "mark" in again.

Generate locales

sudo locale-gen en_US.UTF-8 ; \
sudo echo 'LANG="en_US.UTF-8"' >> /etc/environment ; \
sudo echo 'LANGUAGE="en_US:en"' >> /etc/environment ; \
sudo dpkg-reconfigure console-setup 
Add user Mark to useful groups
sudo addgroup mark adm ; sudo addgroup mark lp; sudo addgroup mark dialout; \
sudo addgroup mark fax; sudo addgroup mark cdrom; sudo addgroup mark floppy; \
sudo addgroup mark tape; sudo addgroup mark audio; sudo addgroup mark dip; \
sudo addgroup mark video; sudo addgroup mark plugdev; sudo addgroup mark staff; \
sudo addgroup mark scanner; sudo addgroup mark fuse; sudo addgroup mark lpadmin; \
sudo addgroup mark admin; sudo addgroup mark sambashare; 

OPTIONAL STEPS

Istall some more packages

sudo apt-get install ubuntu-standard

Istall some more useful command line tools

sudo apt-get install mc vim htop screen 

Istall graphical essential UI

sudo apt-get install xorg icewm xterm 

(you have to do startx for starting GUI)

Istall graphical minimal GUI

sudo apt-get install xubuntu-desktop 

Istall graphical standard gnome GUI

sudo apt-get install ubuntu-desktop 

Istall graphical kde GUI

sudo apt-get install kubuntu-desktop 

Istall medibuntu NON-FREE multimedia components

sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list; \
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update; \
sudo aptitude install libdvdcss2 w32codecs googleearth-4.3 wine virtualbox

Istall windows pseudo-emulation tools (substitute mark with your user)

sudo aptitude install wine virtualbox
sudo addgroup mark vboxusers