“UbuntuHelp:Installation/OverSSH”的版本间的差异
来自Ubuntu中文
小 |
小 |
||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/Installation/OverSSH}} | {{From|https://help.ubuntu.com/community/Installation/OverSSH}} | ||
− | {{Languages| | + | {{Languages|UbuntuHelp:Installation/OverSSH}} |
/!\ This is a work in progress, it is not mature yet and it may break your system! | /!\ This is a work in progress, it is not mature yet and it may break your system! | ||
第13行: | 第13行: | ||
Use <code><nowiki>fdisk</nowiki></code> to partition your hard disk. | Use <code><nowiki>fdisk</nowiki></code> to partition your hard disk. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第27行: | 第26行: | ||
Below is how we get our / populated with ext3. | Below is how we get our / populated with ext3. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
And the same for our swap partition. | And the same for our swap partition. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第43行: | 第38行: | ||
==== Mounting Root ==== | ==== Mounting Root ==== | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第54行: | 第47行: | ||
On an apt based system we can use <code><nowiki>dpkg</nowiki></code> to install it. | On an apt based system we can use <code><nowiki>dpkg</nowiki></code> to install it. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第62行: | 第53行: | ||
If your system is neither, this might work. | If your system is neither, this might work. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第74行: | 第60行: | ||
==== Installing the Base System ==== | ==== Installing the Base System ==== | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第83行: | 第68行: | ||
Change HOSTNAME to whatever suits your environment. | Change HOSTNAME to whatever suits your environment. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
==== fstab ==== | ==== fstab ==== | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
Put the following in fstab: | Put the following in fstab: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
− | |||
proc /proc proc defaults 0 0 | proc /proc proc defaults 0 0 | ||
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1 | /dev/hda1 / ext3 defaults,errors=remount-ro 0 1 | ||
第105行: | 第85行: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
auto lo | auto lo | ||
iface lo inet loopback | iface lo inet loopback | ||
− | |||
auto eth0 | auto eth0 | ||
iface eth0 inet static | iface eth0 inet static | ||
第144行: | 第121行: | ||
It is just bad if you forget this, so just .... | It is just bad if you forget this, so just .... | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
==== Create a user and switch shadow password on ==== | ==== Create a user and switch shadow password on ==== | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第155行: | 第130行: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
==== Installing OpenSSH Server ==== | ==== Installing OpenSSH Server ==== | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第166行: | 第139行: | ||
Choose the right kernel for your architecture. I go with: | Choose the right kernel for your architecture. I go with: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第181行: | 第153行: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
default 0 | default 0 | ||
timeout 3 | timeout 3 | ||
第197行: | 第168行: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第211行: | 第181行: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
− | |||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
第228行: | 第192行: | ||
==== Generate locales ==== | ==== Generate locales ==== | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
− | |||
− | |||
</nowiki></pre> | </nowiki></pre> | ||
2007年5月14日 (一) 10:47的版本
/!\ This is a work in progress, it is not mature yet and it may break your system!
目录
Caveat
As you may already have guessed following this instruction may break your system and you are on your own to fix it again.
Scenario
This instruction describes how to install Ubuntu on a dedicated server over ssh. I assume that your provider provides you with a rescue system from which you can boot and prepare your system. An Online replacement is possible, but it is some more work and a lot more risky if things go bad (the basic idea is to temporarily disable your swap and install a transitional system on it).
Preparing the Hard Disk
Partitioning
Use fdisk
to partition your hard disk.
Remember to set the root partition bootable!
For the rest of this instruction we assume the following partition layout.
/dev/hda1 (83 Linux) - for /, /dev/hda2 (82 Linux swap) - as swap
Creating File Systems
Below is how we get our / populated with ext3.
And the same for our swap partition.
The Base System
Mounting Root
Getting Debootstrap
Debootstrap is a collection of scripts that we will use in the next step to set up a base system. We need an appropriate version of debootstrap
from http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/ to make this work.
Make sure that binutils
is installed on your system.
On an apt based system we can use dpkg
to install it.
If your current system is rpm based, use alien to install it or find a rpm on the web (http://azhrarn.underhanded.org/debootstrap-0.2.23-1.i386.rpm).
If your system is neither, this might work.
Installing the Base System
(arch may be different for you, e.g. md64, hppa, ia64, powerpc, or sparc)
Basic Configuration
Set the Hostname
Change HOSTNAME to whatever suits your environment.
fstab
Put the following in fstab:
proc /proc proc defaults 0 0 /dev/hda1 / ext3 defaults,errors=remount-ro 0 1 /dev/hda2 none swap sw 0 0
Networking
Make sure to use your network details instead.
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 10.0.0.10 network 10.0.0.0 braodcast 10.0.0.255 gateway 10.0.0.1 netmask 255.255.255.0
Make sure to use your hostname and domain.
127.0.0.1 localhost 127.0.0.1 hostname.domain.tld hostname
You need a valid resolv.conf with at least one valid nameserver, e.g.:
nameserver 10.0.0.1
Enter the new environment
Before we chroot into the new environment we need to mount /proc and /dev
mount -t proc none /mnt/ubuntu/proc mount -o bind /dev /mnt/ubuntu/dev LANG= chroot /mnt/ubuntu /bin/bash
Change the root password
It is just bad if you forget this, so just ....
Create a user and switch shadow password on
Installing Packages
Installing OpenSSH Server
Install a Kernel
Choose the right kernel for your architecture. I go with:
Installing GRUB
The boot loader is most important, so do:
apt-get install grub mkdir /boot/grub cp /lib/grub/i386-pc/* /boot/grub vim /boot/grub/grub.conf
default 0 timeout 3 title=Ubuntu root (hd0,0) kernel /vmlinuz root=/dev/hda1 initrd /initrd.img
ln -s /boot/grub/grub.conf /boot/grub/menu.lst
grub> root (hd0,0) grub> setup (hd0) grub> quit
Reboot
Finishing
After the reboot ssh in again.
Generate locales
Istall some more packages
apt-get install ubuntu-standard
References
- The Gentoo Handbook contains a very good (Gentoo specific) instruction on chrooted installation procedures.
- An other instruction from the Ubuntu Installation Guide is somewhat outdated and has shortcomings related to the bootloader installation.
- HOWTO - Install Debian Onto a Remote Linux System - A Debian specific HOWTO.