• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

The great AT Linux/BSD/*NIX FAQ project!

Page 4 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.
I don't know if anyone mentioned this yet because I've not read the whole thread (forgive me if I don't read all 74 messages), but there is already a project which attempts to solve this problem:

The Linux Documentation Project

Perhaps it would be more useful to direct your efforts on continuing the already-existing and already very extensive project than starting your own.

However, no matter what you choose, this is a great cause. Thanks for aiding it.
 
Somebody asked earlier about locating installed RPMs and their files so here's a quick rpm basic tutorial:
  • rpm -qa : list every rpm installed on your system
  • rpm -ql package-name : list the installed files associated with rpm package-name (it should be noted the version # of the package-name can be omitted. Ex: openssh-2.3.1 can be abbreviated openssh). To list the files in an uninstalled rpm use the same command only add the -p option: rpm -qpl package-name
  • rpm -qa | grep regexp : check to see if rpm conatining regexp in its name is installed on your system.
  • rpm -i package-name : install rpm package-name (must be root). Also by adding the --test option you can check for depency problems before actually installing.
  • rpm -U package-name : same as above only Upgrade instead of just install.
  • rpm -qi package-name : list info about package-name. This gives you a general idea of what the package does, what system it's intended for and who put it together. You can also query info from uninstalled packages with with the -p option: rpm -qpi package-name
  • rpm -qf filename : VERY IMPORTANT. Query file filename to see what RPM package it belongs to. This will keep you from deleting a file you think is useless.
  • One last trick. Many people complain about RPM dependency problems. The easiest way to solve these are by using www.rpmfind.net. You can query by a filename or an RPM name. Also if you know you have all the RPMs required to do an install but don't know which ones to install first you can specify them all on the command line with a glob character '*.rpm' and let the rpm command sort out the dependencies itself.


Another 2 FAQs that would be useful: NFS and IPTABLES. NFS is pretty straightforward. IPTABLES will require a little more work.
 
OpenBSD ports v1.1:

You can install ports with the instructions on the following pages: BSD FAQ8 Ports and AnonCVS examples (look for getting ports)

Ports should be installed in /usr/ports, but they can be installed anywhere (I am not sure of all the

implications of installing ports in a different location though).


What are OpenBSD ports?

The ports are software packages in source form that can be downloaded and installed from the command

line. The ports infrastructure takes care of download, compilation, installation, and all dependancies.

AT users like Nothinman say that ports are for users with too much time on their hands, and he may be

right. Packages provide pre-compiled binaries for installation, while ports compiles everything from

source. Ports take longer to install, but the customization can make up for that.

Where can I get more information on this?

OpenBSD ports page
[LOpenBSD port(7) manpage]http://www.openbsd.org/cgi-bin/man.cgi?query=ports&apropos=0&sektion=7&manpath=OpenBSD+Current&arch=i386&format=html[/L] (the new search information is here)


Ok, I have it installed anbd I see a port I want to add, but how do I do it?

I will use tcpstat 1.4 as an example.

cd /usr/ports/net/tcpstat
cd to the directory where the port information is stored.

make
You should not use root permissions to download and compile ports. The ports directory should be owned by the wsrc group. Add your username to the /etc/group file next to wsrc group. This makes dependancies a little more complicated, but it will help make this process more secure. Adding "SUDO=/usr/bin/sudo" to the /etc/mk.conf file will help with the dependancies issues.

This command will download the source, check dependancies (and download/install any necessary dependancies), apply any changes necessary for OpenBSD, and compile the source.

sudo make install
This command creates a package and installs that package. Ports and packages are installed in

/usr/local/. tcpstat would be installed in /usr/local/bin.

There are more advanced options to ports, and I will mention some later on.

Ok, I want an AIM client, but I dont know what is available.

OpenBSD ports makes searching quite easy.

cd /usr/ports
cd to the ports directory.

The following is the old search method, the new method will be explained in a future version.
make search key=aim
This will create a search looking for the keyword "aim." This search retuns the following (on OpenBSD 3.0-stable):

Port: everybuddy-0.2.1beta6
Path: net/everybuddy
Info: chat program that combines AIM, ICQ, and Yahoo! Chat
Maint: Josh Rivel <dorqus@bsdfreek.com>
Index: net
B-deps: audio/esound devel/gmake x11/gtk+
R-deps: audio/esound x11/gtk+
Archs: any

Port: gaim-0.45
Path: net/gaim
Info: Gtk-based AOL Instant Messenger (AIM) client
Maint: Joshua Stein <jcs@rt.fm>
Index: net
B-deps: graphics/gdk-pixbuf
R-deps: graphics/gdk-pixbuf textproc/ispell
Archs: any

Port: gaim-0.45-esd
Path: net/gaim,esd
Info: Gtk-based AOL Instant Messenger (AIM) client
Maint: Joshua Stein <jcs@rt.fm>
Index: net
B-deps: audio/esound graphics/gdk-pixbuf
R-deps: audio/esound graphics/gdk-pixbuf textproc/ispell
Archs: any


There may be other AIM clients, but their descriptions do not include the word "aim." After you have

found the program you want, you can install either the port or the package.

As I mentioned above, there is a new way to do searches, but I have not gotten the chance to play around with it and figure out the little documentation on the subject.


I am trying to install a port with a dependancy for X windows, but I dont want to install X.

I will use ethereal as an example for this one.

cd /usr/ports/net/ethereal
cd to the ethereal port.

env FLAVOR=no_x11 make
This will select the no X11 version of Ethereal.

The first message I get when installing the no_x11 flavor of the ethereal port is ===>ethereal-0.8.19-no_x11 depends on: zsh-* - not found

The ports system then begins downloading the zsh source files for a ports installation.

How can I download a port without installing it?

If you want the source:

cd /usr/port/audio/mpg321
Change to the directory of the port.

make fetch
A make fetch will download the files, but not do anything further.

If you would like a binary of the file, download a package from an OpenBSD site (3.0 packages linked)


How can I find out what ports I have installed?

pkg_info

This will list all ports installed on a system. You can pipe (|) the output to grep if you are

searching for something specific.

pkg_info | grep irssi
Just an example.


How do I remove a port?

An installed port is basically a package.

pkg_delete irssi-0.7.38
This command would delete irssi version 0.7.38 if it was installed on the system.

This could cause problems with dependancies! If the package you are deleting is a dependancy for

another port you will get an error! If this is the case, you should not delete the package, but should

remove all dependants first, and then delete the package.

If you do not want to, do this:

pkg_delete -f qtlibs-2.1
This will Force the deletion. This is a bad idea and can cause problems so it is not recommended. It

is best to play it safe and take a little longer doing everything.


note, this may also apply to FreeBSD and NetBSD, but I have less (or no) experience with these OSes.

The first version of my quick little FAQ was critiqued on deadly.org. Apparently it wasnt all that good. 😛 Ive incorporated many of those changes (removing sudo being the big one), and I will continue to update it when I can. Unfortunately, the grammar problem will continue for a little while 😉

EDIT: Forgot the / 😛
 
Originally posted by: n0cmonkey
OpenBSD ports v1.1:

The first version of my quick little FAQ was critiqued on deadly.org. Apparently it wasnt all that good. 😛 Ive incorporated many of those changes (removing sudo being the big one), and I will continue to update it when I can. Unfortunately, the grammar problem will continue for a little while 😉

I get the feeling that most anandtech readers might be better off with a "What is OpenBSD?" faq though. ;-) "
What a bunch of jerks 😉
 
Originally posted by: TheOmegaCode
Originally posted by: n0cmonkey
OpenBSD ports v1.1:

The first version of my quick little FAQ was critiqued on deadly.org. Apparently it wasnt all that good. 😛 Ive incorporated many of those changes (removing sudo being the big one), and I will continue to update it when I can. Unfortunately, the grammar problem will continue for a little while 😉

I get the feeling that most anandtech readers might be better off with a "What is OpenBSD?" faq though. ;-) "
What a bunch of jerks 😉

Yeah, but a lot of the constuctive comments were worthwhile. They're BSD snobs, what do you expect? Where do you think I got my attitude? Its a requirement 😛
 
Originally posted by: n0cmonkey
Yeah, but a lot of the constuctive comments were worthwhile. They're BSD snobs, what do you expect? Where do you think I got my attitude? Its a requirement 😛
One day I'll get good with FBSD and I too will become an elitist!
 
Here's one that I just figured out:
Linux is unstable when playing games on an Athlon system

There is a bug in the AMD K7 series processors' (Athlon, Duron, XP, MP) implementation of 4M memory pages that can cause memory corruption while AGP is in use, resulting in a freeze. If your system freezes whilst playing games, there is a workaround that may help. This is done by passing the option mem=nopentium to the kernel. Here's how to do it if you use LILO:

1. Open a shell.
2. Become root. su and enter your root password when asked.
3. Open the file /etc/lilo.conf in your favorite text editor.
4. In the block near the bottom that matches the entry you use to boot Linux, add mem=nopentium to the append line. Example from my lilo.conf:
image = /boot/kernel
root = /dev/hda1
label = LFS
append = "mem=nopentium hdc=scsi"
read-write
(the 'hdc=scsi' part turns on SCSI emulation for my cd burner. it is irrelevant to this FAQ, so ignore it.)
5. Save the file and close the editor.
6. Update your boot sector. lilo
7. Reboot.
8. Commit cyber-genocide without fear of M$-like instability! 😀
 
Q: How do I set domainname and get it to survive a reboot?
A: You have to initialize the domainname on boot. The network services reset at every reboot. Thus, in order to set the domainname during boot, do the following:

In etc/sysconfig/network add in the following lines:
NISDOMAIN='xxxxxx.xxx'

In /etc/rc.sysinit add in the following lines:

# Set the NIS domain name
if [ -n "$NISDOMAIN" ]; then
action "Setting NIS domain name $NISDOMAIN" domainname $NISDOMAIN
else
domainname ""
fi

right after the lines:

# Set the hostname.
action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
 
Only thing which I do not like in Linux is the way in which it render fonts (and fonts in general). Is there any way you can enable font smoothing (font aliasing) as we see in Windows?
 
Originally posted by: hasu
Only thing which I do not like in Linux is the way in which it render fonts (and fonts in general). Is there any way you can enable font smoothing (font aliasing) as we see in Windows?

Yes, but I'm not really sure how.
 
bump because someone asked a question that was answered within this great FAQ...

A WINE FAQ couldn't hurt... Also a GLX FAQ perhaps? I never could get GLX to work properly. Then again, I never tried very hard...
 
Thank you for resticking the thread mods!

Wine FAQ is underway. I'm covering CVS-based installation, the differences between the WineHQ and Transgaming trees, and tips for getting troublesome software running. It'll be my longest FAQ yet! 🙂

Afterwards, I'm going to work on a little guide to the command prompt, which was my original plan for this thread before the suggestion for in-depth FAQs came up.
 
Can I run Windows software on UNIX?As strange as it sounds, yes. You can run SOME Windows software on UNIX systems using WINE.

WINE is a recursive acronym that means "WINE Is Not an Emulator", but it could easily mean "Windows Is Nearly Exinct". 🙂 It runs on Linux, FreeBSD, and Solaris, and possibly some other *NIX variants too. It is a free implementation of the Win32 API that, among other things, lets you run Windows software on *NIX.

There are several independantly maintained "forks" of WINE, in addition to the "official" tree maintained by WINE Headquarters. The most popular fork, even more popular than the official tree, is WineX, a gaming-centric fork maintained by Transgaming Technologies. This fork has the distinct advantage of DirectX 8.0 support, allowing you to play many recent Windows games. I use WineX, so the instructions in this FAQ will be based on it, but most, if not all, of it should work just fine with the official tree, which will be referred to throughout this FAQ as WineHQ.

Before you can use WINE, you need to install it. Binary releases (RPMs, apt-gettable packages, ports, etc) are available, but are often outdated. If your distro comes with a WINE package, don't install it, or if you already did, remove it. By following this FAQ, you will be getting the WINE source code from a CVS server, and compiling it yourself.


You must now decide if you want the WineHQ or WineX version.
NOTE: In the commands below, wherever it says : pserver: below, remove the space between the colon 🙂 ) and pserver. I had to add the space to keep the forum from screwing it up.

To get the WineHQ source:

1. Open a shell window.
2. cvs -d : pserver:cvs@cvs.winehq.com:/home/wine login
3. You will be asked for the password. It is cvs
4. cvs -z3 -d : pserver:cvs@cvs.winehq.com:/home/wine co wine


Or, to get the WineX source:

1. Go to Transgaming's Site and read the licence.
2. Open a shell window.
3. cvs -d : pserver:anonymous@cvs.winex.sourceforge.net:/cvsroot/winex login
4. You will be asked for the password. Just hit enter.
5. cvs -z3 -d : pserver:anonymous@cvs.winex.sourceforge.net:/cvsroot/winex co -r winex-2-0-branch wine


Either way, the last command will begin the download. It will take a few minutes. When it is done, you will have the source code in the wine subdirectory of wherever you were when you ran the above commands. You will need to compile and install it next.

While still in the shell window:

1. Become root. su and enter your root password when asked.
2. cd wine
3. tools/wineinstall
4. It will take a long time for WINE to compile, so go do something productive.
5. When it is done compiling, it will ask a few questions. If I recall correctly, they are all yes/no questions, and you should answer 'yes' to all of them. If the setup program asks for a "fake windows root" directory, it will offer a default setting of /c. Accept that.
6. Open /etc/ld.so.conf in a text editor. If there is a /usr/local/lib line in it, no changes need to be made. If there isn't, add it.
7. ldconfig
8. chmod -R 777 /c
8.5. Optional for better performance, but a very serious security risk: chmod 777 /dev/mem
9. exit
10. cd ~
11. su and enter root password when asked.
12. chown -R (your username) .wine
13. exit
14. which wine
If it says /usr/local/bin/wine you're all set. If it says No wine found in {big list of directories} then do export PATH=$PATH:/usr/local/bin


Now WINE is installed, but you still have to do some additional configuration before you can run all of your favorite Windows apps.

1. Open ~/.wine/config in a text editor.
2. The first few stanzas define the drive letters that your Windows software will see. Make sure the Floppy and CD-ROM sections point to the proper locations.
3. Now scroll down to the x11drv section. Here you will find options that control the appearance of Windows apps. The following settings are good to know:
PerfectGraphics: The performance hit isn't that bad, and has no effect on games. Set this to Y.
Managed: This makes Windows apps behave more like proper X client apps. I set this to N, and run WINE with the --managed switch when starting an app I want to use like this.
Desktop: When this is uncommented, Windows apps will be confined to a window whose demensions are specified here. Some games won't work if this is enabled, some won't work if it isn't enabled. This is one of the many things to play with if a program doesn't work at first. Put a semicolon (; ) in front of this line to disable it, and remove the semicolon to enable it.
DesktopDoubleBuffered: Set this to Y.
4. Save the file and exit the editor.

It is now time to give things a little test.

1. Find a simple Windows app, such as Notepad, or SkiFree, or something like that.
2. Put it in the /c directory.
3. cd /c
4. wine ./appname.exe
5. If all has gone well, you will see some font-related stuff scroll by for awhile, and then the app will appear. If it doesn't, chances are you got some bad source code. Uninstall WINE and try again...
rolleye.gif


If all went well with that test, it's time to put WINE to some serious use. Try installing Microsoft Office, or your favorite Windows game. Keep in mind that very few games work perfectly, and most don't work at all.


WINE must be run from a command line. The basic structure of the command is:

wine --wine --switches -- ./appname.exe -app -switches

The final -- before the ./appname.exe tells WINE that the switches that follow are for the Windows app, not WINE. For example:

wine --debugmsg -all -- ./MaxPayne.exe -developer

The above will tell WINE not to show any debugging messages, and to pass the -developer switch to the app (Max Payne in this case. It enables the console, allowing entry of cheat commands! 😀)

Omitting the --, however, will have fatal consequences:

wine --debugmsg -all ./MaxPayne.exe -developer

The above would produce an error, since WINE doesn't understand the -developer switch.


Congratulations, you have now successfully run a Windows app on UNIX! The only thing worse for Microsoft would be another barrage of pies in Bill Gates' face. 😉


If you want to uninstall WINE:

1. Open a shell window.
2. Become root. su and enter root password when asked.
3. cd to the directory containing the WINE source code.
4. make uninstall
 
An introduction to the UNIX command promptOne of the most significant differences between Windows and *NIX operating systems is that you can go your whole life without ever opening a command prompt in Windows, but you have to use it every day in *NIX. If you intend to switch to a *NIX OS, you need to know how to use the command prompt.

First off, unlike DOS and Windows which only offered one shell (command.com and its ilk), *NIX operating systems offer several different ones. The default shell in Linux is BASH. The default shell in OpenBSD is KSH. Other *NIXen may have different default shells. Generally, however, you can install your favorite shell on any *NIX system if you don't like the default. I use BASH, and so this guide is a bit slanted towards it. If anyone who uses another shell could contribute info relevant to their shell, I'd appreciate it.


Getting help:
man command - Almost always shows you the manual for the specified program. When told to 'RTFM', this is what you must do.
apropos word - Kinda like a search engine for man.


Moving around the file system:
Navigating the *NIX file system is very similar to DOS. Some of the commands are a little different, but they behave the same.
cd dirname - Changes to the specified directory.
cd .. - Changes to the parent of the current directory.
pwd - Prints the current directory. Usefull if, for whatever reason, your prompt doesn't give this info.
ls - Directory listing. use the -lh switch to get a detailed listing. Use the -a switch to show hidden files.


Archives:
tar xzf file.tar.gz - Unpack a .tar.gz file. Doesn't work in all systems.
tar xf file.tar - Unpack an uncompressed .tar file.
gunzip file.gz - Uncompress any .gz file, tar or otherwise. If the file you are decompressing is a .tar.gz, it will not be unpacked, it will simply become a normal .tar file.
bunzip2 file.bz2 - Uncompress any .bz2 file.

tar cf file.tar dirname - Put the contents of a directory into a .tar file.
gzip file - GZip compress a file.
bzip2 file - BZip2 compress a file. This is a pretty good compression method, I suggest you use it.


Viewing and editing files:
cat - Outputs the contents of a text file. Only useful on small files.
more - A somewhat simple text file reader. Hit a key to go to the next page. Works a lot like the one in DOS.
less - A really nice text file reader. Lets you scroll up or down using arrow keys, pageup/down, space, and so on. Q exits. You can get a scrollable directory listing with ls -lha | less

vi file - A really nice text editor, albeit a bit tricky to use. My favorite.
nano file - I'm told this text editor works like Notepad and MS-DOS EDIT. I wouldn't know, I only use VI. 😉
gvim file - If you have this editor on your site, it can't be beat.


Environment variables:
PATH - Tells the shell where to look for programs if you don't tell it exactly where it is. It works like the DOS PATH variable, but with colons (:) instead of semicolons (;) to seperate the entries. For example: /bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/opt/mozilla

export - In BASH, this command is used to set an environment variable.



This is a very rough and hastily thrown-together guide, more or less meant as a starting point for someone else to work on a better FAQ.
 
Back
Top