特殊:Badtitle/NS100:Installation/OverSSH
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Installation/OverSSH }} |
点击翻译: |
English {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/af | • {{#if: php5|Afrikaans| [[::Installation/OverSSH/af|Afrikaans]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ar | • {{#if: php5|العربية| [[::Installation/OverSSH/ar|العربية]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/az | • {{#if: php5|azərbaycanca| [[::Installation/OverSSH/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/bcc | • {{#if: php5|جهلسری بلوچی| [[::Installation/OverSSH/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/bg | • {{#if: php5|български| [[::Installation/OverSSH/bg|български]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/br | • {{#if: php5|brezhoneg| [[::Installation/OverSSH/br|brezhoneg]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ca | • {{#if: php5|català| [[::Installation/OverSSH/ca|català]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/cs | • {{#if: php5|čeština| [[::Installation/OverSSH/cs|čeština]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/de | • {{#if: php5|Deutsch| [[::Installation/OverSSH/de|Deutsch]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/el | • {{#if: php5|Ελληνικά| [[::Installation/OverSSH/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/es | • {{#if: php5|español| [[::Installation/OverSSH/es|español]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/fa | • {{#if: php5|فارسی| [[::Installation/OverSSH/fa|فارسی]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/fi | • {{#if: php5|suomi| [[::Installation/OverSSH/fi|suomi]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/fr | • {{#if: php5|français| [[::Installation/OverSSH/fr|français]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/gu | • {{#if: php5|ગુજરાતી| [[::Installation/OverSSH/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/he | • {{#if: php5|עברית| [[::Installation/OverSSH/he|עברית]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/hu | • {{#if: php5|magyar| [[::Installation/OverSSH/hu|magyar]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/id | • {{#if: php5|Bahasa Indonesia| [[::Installation/OverSSH/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/it | • {{#if: php5|italiano| [[::Installation/OverSSH/it|italiano]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ja | • {{#if: php5|日本語| [[::Installation/OverSSH/ja|日本語]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ko | • {{#if: php5|한국어| [[::Installation/OverSSH/ko|한국어]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ksh | • {{#if: php5|Ripoarisch| [[::Installation/OverSSH/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/mr | • {{#if: php5|मराठी| [[::Installation/OverSSH/mr|मराठी]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ms | • {{#if: php5|Bahasa Melayu| [[::Installation/OverSSH/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/nl | • {{#if: php5|Nederlands| [[::Installation/OverSSH/nl|Nederlands]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/no | • {{#if: php5|norsk| [[::Installation/OverSSH/no|norsk]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/oc | • {{#if: php5|occitan| [[::Installation/OverSSH/oc|occitan]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/pl | • {{#if: php5|polski| [[::Installation/OverSSH/pl|polski]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/pt | • {{#if: php5|português| [[::Installation/OverSSH/pt|português]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ro | • {{#if: php5|română| [[::Installation/OverSSH/ro|română]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/ru | • {{#if: php5|русский| [[::Installation/OverSSH/ru|русский]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/si | • {{#if: php5|සිංහල| [[::Installation/OverSSH/si|සිංහල]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/sq | • {{#if: php5|shqip| [[::Installation/OverSSH/sq|shqip]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/sr | • {{#if: php5|српски / srpski| [[::Installation/OverSSH/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/sv | • {{#if: php5|svenska| [[::Installation/OverSSH/sv|svenska]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/th | • {{#if: php5|ไทย| [[::Installation/OverSSH/th|ไทย]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/tr | • {{#if: php5|Türkçe| [[::Installation/OverSSH/tr|Türkçe]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/vi | • {{#if: php5|Tiếng Việt| [[::Installation/OverSSH/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/yue | • {{#if: php5|粵語| [[::Installation/OverSSH/yue|粵語]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/zh | • {{#if: php5|中文| [[::Installation/OverSSH/zh|中文]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/zh-hans | • {{#if: php5|中文(简体)| [[::Installation/OverSSH/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OverSSH}}/zh-hant | • {{#if: php5|中文(繁體)| [[::Installation/OverSSH/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:php5|:Installation/OverSSH|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Installation/OverSSH/zh | | {{#ifexist: Installation/OverSSH/zh | | {{#ifeq: {{#titleparts:Installation/OverSSH|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Installation/OverSSH|1|-1|}} | zh | | }}
/!\ 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.
# fdisk /dev/hda 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 swapCreating File Systems
Below is how we get our / populated with ext3.# mke2fs -j /dev/hda1 And the same for our swap partition.# mkswap /dev/hda2 # sync; sync; sync # swapon /dev/hda2The Base System
Mounting Root
# mkdir /mnt/ubuntu # mount -t ext3 /dev/hda1 /mnt/ubuntuGetting 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 ofdebootstrap
from http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/ to make this work. Make sure thatbinutils
is installed on your system. On an apt based system we can usedpkg
to install it.# wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.0ubuntu2_all.deb # dpkg -i debootstrap_0.3.3.0ubuntu2_all.deb 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.# mkdir /work; cd /work # wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.0ubuntu2_all.deb # ar -xf debootstrap-udeb_0.3.3.0ubuntu7_i386.udeb # cd / # tar zxvf work/data.tar.gzInstalling the Base System
# /usr/sbin/debootstrap --arch i386 dapper /mnt/ubuntu http://archive.ubuntu.com/ubuntu (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.# echo HOSTNAME > /mnt/ubuntu/etc/hostnamefstab
# vim /mnt/ubuntu/etc/fstab Put the following in fstab:# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/hda1 / ext3 defaults,errors=remount-ro 0 1 /dev/hda2 none swap sw 0 0Networking
Make sure to use your network details instead.#Network Config: # The loopback network interface auto lo iface lo inet loopback # The primary network interface 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.1Enter the new environment
Before we chroot into the new environment we need to mount /proc and /devmount -t proc none /mnt/ubuntu/proc mount -o bind /dev /mnt/ubuntu/dev LANG= chroot /mnt/ubuntu /bin/bashChange the root password
It is just bad if you forget this, so just ....# passwdCreate a user and switch shadow password on
# dpkg-reconfigure --default-priority passwdInstalling Packages
# apt-get updateInstalling OpenSSH Server
# apt-get install openssh-serverInstall a Kernel
Choose the right kernel for your architecture. I go with:# apt-get install linux-image-686Installing 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# /boot/grub/grub.conf default 0 timeout 3 title=Ubuntu root (hd0,0) kernel /vmlinuz root=/dev/hda1 initrd /initrd.imgln -s /boot/grub/grub.conf /boot/grub/menu.lst# grubgrub> root (hd0,0) grub> setup (hd0) grub> quitReboot
# exit # cd /# umount /mnt/ubuntu/proc # umount /mnt/ubuntu/dev # umount /mnt/ubuntu # rebootFinishing
After the reboot ssh in again.Generate locales
# locale-gen en_US.UTF-8 # echo 'LANG="en_US.UTF-8"' >> /etc/environment # echo 'LANGUAGE="en_US:en"' >> /etc/environmentIstall some more packages
apt-get install ubuntu-standardReferences
* UbuntuHelp:Installation/FromKnoppix * 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.