USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

How-To Install Archlinux on a USB Stick and boot from it!

 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Installation and Bootloaders
View previous topic :: View next topic  
Author Message
platinummonkey
Advanced Member


Joined: 01 Mar 2024
Posts: 732
Location: Texas

PostPosted: Sat Feb 02, 2024 7:58 am    Post subject: How-To Install Archlinux on a USB Stick and boot from it! Reply with quote

How-To Install Archlinux on a USB Stick and boot from it!

Okay, really, this isn't much different than installing onto a hdd... Wink There are just a couple tweaks really and more immediate storage size limitations and making it a little more adaptable....
PATIENCE REQUIRED Very Happy

##### Getting Ready #####
1. Download the latest base iso from archlinux and burn to a cd.

Note: Some assumptions are made about your what you are using to accomplish this:
- Your USB flash drive is at least 1GB (it can be done on much smaller, though you will probably not be able to install a DE/WM, etc and X windows, just bc of the space requirements)
- You have another desktop/laptop to be the host (OS independent!)
- You have access to the internet! (obviously you do or you wouldn't be here Razz)
- You have more than basic knowledge of the linux OS and how it operates.
- Your host machine has one hdd already installed and a cd-rom drive.
- You know how to use either vi or nano! (Command line text editors)

##### Let's Start! #####
2. With the host computer off, start it up and boot from the arch cd you burned earlier.

3. When the first screen comes up giving you the install options, enter "arch"

4. A new terminal will show, press any key, then type "/arch/setup" to enter the normal installation.

##### Configure Network #####
5. I would suggest doing an ftp install, especially if you have only a 1GB USB stick or less! Otherwise, CD install is fine. This is pretty straight forward, you most likely be using dhcp to connect btw Wink

##### Prepare the USB stick #####
6. Back to the main menu, select "Prepare Hard Drive", and select your USB stick
Note: If you have only 1 HDD on the host, and 1 USB connected, your USB stick will probably be given the name /dev/sdb and your HDD /dev/sda. If you have more than one HDD then the names will continue in alphabetical order: /dev/sd[a-z] (NOTE: your HDD might also be called /dev/hd[a-z]!)

7. When given the option of how to prepare, choose "Parition Hard Drive" which will run cfdisk on the device you picked Wink

8. The commands to operate cfdisk are shown on the bottom. Wink Delete any existing parition(s) and create a new Primary partition using the Linux type (83), and make it bootable.

Note: If you have a USB stick larger than 1GB I would suggest reserving say 512MB - 256MB for a secondary FAT32 Logical partition.

9. Write it disk and exit. Now select "Set Filesystem Mountpoints". Set as the following:
Parition Mountpoint FileType
None swap ext2 # I chose ext2 since it is a little faster and we really don't need journalling on the flash drive Razz
/dev/sdb1 / fat32
Note: If you did the extra logical partition, then mount /dev/sdb5 as /media/global

You are done with that. Return to the main menu.

##### Select and Install Packages ######
10. Whether you are dong FTP or CD installation; select the base and say yes to all of the packages.

11. Install those packages and give it a sec to install. NOTE: When asked if to keep the packages in the cache SAY NO! (We dont have that much space to begin with, why one earch would we want to keep that Razz)

##### Configure System #####
12. You are going to want to edit a few files here. The first being rc.conf:
- Change your hostname to whatever you like. (Ex. "usbbooted")
- Comment out the original instance of "eth0" and create a new one below with: eth0="dhcp"

13. Make sure fstab contains the /dev/sdb or w/e of the partitions from your usb stick.

14. Edit mkinitcpio.conf:
- All the way at the bottom, change the hooks to: "base ide usb filesystem"

15. Set root password!

##### Install Kernel #####
16. Install the kernel (the latest arch cd will use the correct flags, if not, then use this command:
Code:
mkinitcpio -k 2.6.19-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26.img


Note: A fallback will be configured with all the hooks, this is ok! Razz

##### Install Bootloader #####
17. Install the bootloader to the MBR (Ex. /dev/sdb) and once accomplished it will prompt you to look at the /boot/grub/menu.lst config file.
- Check and make sure that root is set to root(hd0,0) Though this may change if your bios on the host computer declares the HDD as hd0 and the USB as hd1, then root(hd1,0) is fine.
- Check to see that on the kernel line that root is set to the USB boot partition (Ex. /dev/sdb1)
Save and exit.

##### Before First Boot #####
18. Fire up your host machine (Linux preferrebly here) and change the volume label of both partitions on the USB stick.
- On Linux:
- e2label /dev/sdb1 volumelabel1 # volumelabel can be anything, just keep it short and simple (Ex. usbr00t)
- Install mtools, and: mlabel -i /dev/sdb5 ::volumelabel2 # A DIFFERENT ONE FROM THE FIRST!
- On Windows: Use the system admin tools, though ext2... uh. Somebody fill that one in.
- On Mac: beats me Razz
We are doing this so /etc/fstab can be more dynamic and adjust to the system you boot your USB stick from! Very Happy

19. Fire up your fav text editor and edit the /etc/fstab file on your USB stick NOT THE ONE ON THE HOST MACHINE!
- Change:
Code:
 /dev/sdb1  /   ext2   defaults  0 1
/dev/sdb5  /media/global  vfat defaults 0 2
entries to:
Code:
LABEL=volumelabel1  /  ext2   defaults  0 1
LABEL=volumelabel2  /media/global  vfat rw,suid,exec,auto,nouser,async  0   2

Making sure you differentiate between the two volume labels!
Save and Exit.



_________________
desktop - FreeBSD 7.2
laptop & server - Archlinux i686 kernel26 2.6.32.10-1
- TAMULinux-2.0.2-ALPHA
USB Boot - Archlinux i686 kernel26 2.6.32.10-1 USB boot


Last edited by platinummonkey on Sat Feb 02, 2024 8:00 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website AIM Address
platinummonkey
Advanced Member


Joined: 01 Mar 2024
Posts: 732
Location: Texas

PostPosted: Sat Feb 02, 2024 7:58 am    Post subject: Reply with quote

##### First Boot #####
Note: You may have issues with grub being picky about the root drive. Just edit the /boot/grub/menu.lst or temporarily edit it from grub to get it to boot, you can edit this file once you get it to boot fully.

20. Log in as root! and open up /etc/locale.gen and uncomment the locale you want to use and make sure you update your rc.conf if you plan on using something other than en_US.utf8! Then follow it up with:
Code:
locale-gen


21. update!
Code:
pacman -Sy pacman
pacman -Syu


22. While that is updating, go to VC/2, login as root, and add a new user:
Code:
adduser
enter whatever you want making sure to add them to the following groups: optical,storage,audio,users

23. While you are still updating, you are probably going to want to look at this (not 100% required now, but if you can it will give you something to do while you wait) http://wiki.archlinux.org//Using_udev_to_map_multiple_entries_to_a_device
Create new rules if you feel you need them!

##### Installing Fluxbox #####
24. Once the update has finished we are going to install our X windows, DE and other necessities!
Code:
pacman -Scc #delete all those cached pkgs :P dont need them anymore!
pacman -Sy fluxbox fluxconf fluxter fbnews fbpager xorg xf86-video-vesa xf86-input-keyboard xf86-input-mouse libgl-dri ttf-bistream-ver ttf-dejavu ttf-ms-fonts xterm screen irssi firefox links slim openntpd alsa-lib alsa-oss alsa-utils


25. While that is downloading and installing we are going to set up our directories and install menumaker from the AUR while in VC/2 as root.
Code:
wget http://aur.archlinux.org/packages/menumaker/menumaker.tar.gz
tar xvf menumaker.tar.gz
cd menumaker
makepkg
pacman -U menumaker-0.99.7-4-i686.pkg.tar.gz --asroot # versioning will prob be different ;)
cd
rm -r ./menumaker
rm menumaker.tar.gz
NOTE: menumaker is not required, but it makes editing the menus a bit easier, so says many people Razz It isn't very large, so why not? Razz

26. Let's make our directories for fluxbox. logout of VC/2 and log back in as a normal user.
Code:
mkdir -p ~/.fluxbox/styles
   cd ./.fluxbox
   mkdir ./backgrounds

- Now lets generate a menu!
Code:
fluxbox-generate_menu
- You can edit the menu now using a text editor: nano ./menu
- Lets create fluxbox's startup list!: nano ./startup and set it to:
Code:
#fbsetbg -l # sets the last background set, very useful and recommended.
# In the below commands the ampersand symbol (&) is required on all applications that do not terminate immediately.
idesk &
xterm &
exec /usr/bin/fluxbox -log ~/.fluxbox/log
We will set the bg later, and edit this once again.

27. Let's set up our ~/.xinitrc since we are using slim using our fav text editor!
- Add the following:
Code:
#!/bin/sh
   startfluxbox


28. Logout of VC/2 and back in as root. We are going to copy the fluxbox config and .xinitrc to root's home.
Code:
cp -r /home/username/.fluxbox ~
 cp /home/username/.xinitrc ~


##### Setting Up X #####
29. Installation on VC/1 should be done by now, so lets logout of VC/2. And clear the cache again.
Code:
pacman -Scc
and install hwd!
Code:
pacman -Sy hwd
pacman -Scc
.

30. Let's generate an xorg.conf!
Code:
hwd -xa
Make sure to take a look at it and make sure nothing too funky is there. NOTE: Make sure the drivers are using "vesa" not "nvidia" or "fglrx" or w/e. VESA is generic and should work from system to system. http://wiki.archlinux.org//Xorg#Xorg_-configure for more info on Xorg.

##### Before we restart! #####
31. Let's update our /etc/rc.conf
Code:
# In the daemons line, lets add the following:
@slim @openntpd @alsa
The "@" backgrounds them, so you can boot faster Wink

32. Edit your /etc/slim.conf
- You can change some settings here, all optional, the defaults should work okay.
- If you want extra themes you can install the "slim-themes" package

33. Edit your /etc/ntpd.conf
- Not necessary right now, but it will sync to whatever server you want that has the correct time zone for you, instead of relying on the host machine's BIOS Razz

34. Edit your /boot/grub/menu.lst
- Not necessary anymore, but you can add "vga=793" to the kernel line and add w/e other options you want.
- If you want to you can change the "root=/dev/sdb1" on the kernel line to "root=LABEL=volumelabel1" to be more dynamic, though you will need to also add "rootdelay=8" or higher so that it boots properly. You may even have to add a udev entry to ignore /dev/sdb1 from trying to mount it...

35. You could install mpd, mpc, xmms, and gstreamer0.10-plugins for audio/video support, but only if you have space! Razz

##### Reboot and enjoy! #####
36. Continue to edit your fluxbox settings and install what you want, and enjoy a very portable and adaptable Linux installation! Never be stuck with another OS again! Razz

Estimated time to complete: ~2-3 hrs if your real fast Razz
REMEMBER Archlinux is not a newbie distro, so be wary and I'm not responsible for you accidently isntalling over or writing over any of your host machine's files! Razz That's you being silly in the head Wink

Hope this was clear enough and I didn't forget anything! Enjoy! Very HappyVery HappyVery HappyVery Happy



_________________
desktop - FreeBSD 7.2
laptop & server - Archlinux i686 kernel26 2.6.32.10-1
- TAMULinux-2.0.2-ALPHA
USB Boot - Archlinux i686 kernel26 2.6.32.10-1 USB boot
Back to top
View user's profile Send private message Visit poster's website AIM Address
platinummonkey
Advanced Member


Joined: 01 Mar 2024
Posts: 732
Location: Texas

PostPosted: Sat Feb 02, 2024 8:20 am    Post subject: Reply with quote

Also, instead of volume labels, you could find out the uuid of the USB stick and assign that way. May work better in some cases? I didn't do this though.
Use udevinfo for this, that link above about udev will explain this as well and the /etc/fstab entry would look like:
Code:
/dev/disk/by-uuid/some-uuid / ext2 defaults 0 1
and the grub kernel line looking something like:
Code:
root=UUID=f0bfe866-2449-4d75-8222-b444ff564876
# where after the UUID is the USB's uuid!


If anyone wants to know. I installed this on a Sandisk Cruzer Micro 2GB. My host machine being my already borked laptop (which gets sent off tomorrow to get a new hdd courtesy of the warranty Razz)
1.75GB - ext2 - I could've gotten away with just over 1GB and the rest fat32... but at least it gives me some room to play with Razz
256MB - fat32

The logical fat32 partition was created so I can access documents still if I didnt want to boot from the USB, and wanted to use one of those other OS's but still be able to transfer data. On it, contains fs-driver for windows to read/write to the ext2 partition, and other documents. Razz



_________________
desktop - FreeBSD 7.2
laptop & server - Archlinux i686 kernel26 2.6.32.10-1
- TAMULinux-2.0.2-ALPHA
USB Boot - Archlinux i686 kernel26 2.6.32.10-1 USB boot
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Installation and Bootloaders All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse