To enter into the world of linux and open source first thing you need to do is to choose a distribution to install. There are hundreds of distributions but you will probably choose one of the most popular and user friendly. Here is a short list
There are also live cds which can install into disk like
And other common used but not recommended for beginners like
It doesn't matter which distribution you choose since they are all Linux based! However each one has its fun club because of the special characteristics it has. So what should you choose?
Here is what I recommend. Either Suse or Ubuntu for beginners since they are the most attractive and user friendly in my opinion. If it is possible use a live cd before installation to check out how it would be after install. They both provide this and as this lines are written Ubuntu uses its installation on a live cd as a default. After seeing all the popular distibutions and using Suse 9.3 for one year being very satisfied I realized that each major distribution that has a commercial based plan has its drawbacks.
I will focus on some advantages I saw in Debian that made it my favorite distribution.
If you have fast internet connection use the latest testing release of netinstall cd and follow instructions you 'll find later on this manual. If you don't, get somehow the latest 3 dvds of the latest testing release. They have everything. However if you are undecided yet on whether you will move on to Linux install Kubuntu 6 live cd, or Suse 10.2 and check out the Kororaa Xgl live cd.
Then if you really want to do it, do it the debian way!
Anyway I am a Linux and Debian enthusiast so not to be misunderstood I am not trying to convince you on Debian, anything you choose would be good, my needs are not everyones and all the distros have there supporters for good reasons! Make any Linux choice.
With Debian you have the advantage of choosing between stability, latest software or somewhere in between So if you are using a server you will probably choose the stable packages. On the other hand for everyday use you will most likely use testing or unstable tree. In brief:
In practice even while using unstable packages it is still a Linux distribution and is far more stable than windows.
See www.people.cornell.edu/pages/kk288/debian_choosing_distribution.html
There is also a howto available as a package
apt-get install apt-howto
/usr/share/doc/Debian/apt-howto/apt-howto.en.el.html
You can invoke it also by executing
apt-howto
in command line. It is translated in may languages including greek! (Though there are problems in links)
The 1st problem in a linux installation is when you try to initiate sth from the console when login as root. It displays the error :
cannot connect to X server
A solution is to change the XAUTHORITY in the /root/.bashrc file with the lines below for any user, even root, after loging in in the X environment as a common user e.g. vagelis
from konsole login afterwards as root and execute
cp ~vagelis/.Xauthority ~/.Xauthority
However this is only temporary. When you log out from the window manager and login again you will have to execute it again There is a permanent solution it is intented to work only if you login as a specific normal user always (e.g. vagelis). And ofcourse never as root in a window manage
Add to your bashrc file lines
# ~/.bashrc export XAUTHORITY=~vagelis/.Xauthority
Now you will always be able to execute X applications after executing su command but only when you are logged in X environment as user vagelis
Another solution in kde is to run from a terminal the command
kdesu <application>
For gnome use
gksu <application>
Τhese commands do work ofcourse from any window manager as long as they are installed!
To use multiple consoles in a remote host use the
screen
command after you login there with ssh After executing screen try
CTRL-a-c to create a new screen
then with CTRL-a-? all possible commands CTRL-a-0 you move to the first CTRL-a-1 you move to the second CTRL-a-n next screen CTRL-a-p previous screen
CTRL-a-d disconnect from screens with logout (screen continues execution)
if you connect again with ssh use
screen -r
to take over from where you left it
This is how to execute an X application that will display on the computer you are logged in via ssh The ssh daemon must be installed and running ofcourse
apt-get install openssh-server /etc/init.d/ssh start
Suppose you connect from localpc to remotepc
Use command
ssh remotepc
At first $DISPLAY variable is not set. So after connecting to remotepc execute
export DISPLAY=:0 # or export DISPLAY=remotepc:0 xterm
An xterm will popup on the remotepc display
Now can you make this remote executed X application display in your localpc?
Yes you can! The security mechanism that doesn't allow it at first is xauthority You need to add to the remotepc your current localpc magic cookie number located in ~/.Xauthority In your local pc execute
xauth list $DISPLAY
It will produce output
localhost.localdomain:0 MIT-MAGIC-COOKIE-1 6ab86634b717cd5ba682714433887d24
The magic cookie number is 6ab86634b717cd5ba682714433887d24. Login now to the remote pc
ssh remotepc export DISPLAY=localpc:0 xauth Using authority file /home/vagelis/.Xauthority xauth>add athlonpc:0 . 6ab86634b717cd5ba682714433887d24 xauth>exit Writing authority file /home/vagelis/.Xauthority xterm
So now xterm which is remotely executed will display locally. Be sure to close all remote applications before you logout. The magic cookie is security to your local pc. It expires on logout from X session on your local pc.
More information can be found in the following site http://www.xs4all.nl/~zweije/xauth.html.
To login in to a normal graphical display remotely to a Windows server running rdp (remote desktop protocol), install rdesktop (console) or krdc clients (X application).
By default WinXp allows only 1 login so you must logout before from your local windows session. WinXp server allows 2 logins, unless your purchase microsoft terminal services.
apt-get install rdesktop krdc
login using
rdesktop -f -a 16 remotepc
From all commands ping is maybe the most common used in setting up or troubleshooting networking. To check if you can reach a certain pc try pinging its ip or dns name
ping 192.168.1.10 ping www.google.com
To stop it, just like you would do in any process, press CTRL-C
You can configure the ip addresses of your machine interfaces the manual and temporary way with ifconfig command. Just execute
ifconfig
and all the enabled interfaces with assigned ip addresses will be shown Suppose you want to assign 192.168.1.10 to your eth0 device. Try
ifconfig eth0 192.168.1.10
If you want to assign a 2nd address to eth0 interface e.g. 10.2.12.8 ως eth0:0 use
ifconfig eth0:0 10.2.12.8
A route to the default gateway is also written with every ifconfig. See route - configure routing To enable an interface, e.g. eth0 use
ifconfig eth0 up
To disable it
ifconfig eth0 down
If you want to get an ip from a dhcp server try
apt-get install dhclient dhclient
If there are more than one servers you can reach and you want to reject ips given from specific server e.g. from 192.168.1.1 and 10.2.12.1 edit the file /etc/dhclient.conf and add below lines for example
reject 192.168.1.1; reject 10.2.12.1;
To enable getting ips from dhcp on startup use the following line in /etc/network/interfaces
iface eth0 inet dhcp
instead of
iface eth0 inet static address 10.26.145.16 netmask 255.0.0.0 gateway 192.168.1.254
To see the current route table execute
route -n
(-n causes ips not to be resolved and so is much faster)
To add a default gateway for all ips that don't have a specific routing
route add default gw 192.168.1.254
To add a gateway for all ips in a given range e.g. all 10.x.x.x
route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.26.145.1
To enable this routes on startup change file /etc/network/interfaces as follows
iface eth0 inet static address 10.26.145.16 netmask 255.0.0.0 up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.26.145.1 down route del -net 10.0.0.0 netmask 255.0.0.0 gw 10.26.145.1 gateway 192.168.1.254
and checkout with ifconfig and route if they were applied
After you do your tests with ifconfig write them to /etc/network/interfaces to load at startup. Here is a sample file that assigns
# The loopback network interface auto lo iface lo inet loopback address 127.0.0.1 netmask 255.0.0.0 # This is a list of hotpluggable network interfaces. # They will be activated automatically by the hotplug subsystem. mapping eth0 script grep map eth0 # The primary network interface auto eth0:0 eth0 iface eth0 inet static address 10.26.145.16 netmask 255.0.0.0 up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.26.145.1 down route del -net 10.0.0.0 netmask 255.0.0.0 gw 10.26.145.1 gateway 192.168.1.254 iface eth0:0 inet static address 192.168.1.68 netmask 255.255.255.0
For other examples see /usr/share/doc/ifupdown/examples/network-interfaces.gz
Edit /etc/resolv.conf
If your addresses have a suffix of .mydomain e.g. myrouter.mydomain then to be able to use the name only e.g. myrouter add
search mydomain
Add also the list of dns servers in the order you want them to be queried
nameserver 10.26.126.15 nameserver 192.168.1.254
Then test with
apt-get install dnsutils nslookup <name to be resolved>
Below instructions were applied to the intracom external usb/serail isdn modem 1)
To access kppp from all users
chmod +x /usr/bin/kppp
In Kppp just change the modem type to /dev/usb/ttyACM0
If you can't see it it the menu manually add a link to it to /dev/modem as follows
rm /dev/modem, # to remove older links ln -s /dev/usb/ttyACM0 /dev/modem
Then use /dev/modem in kppp
PAP is the protocol select 115200, no wait for dialtone and save password For Intracom isdn modem at the AT commands remove the commands for modem speaker (it doesn;t have) As initialization string use ATJA80JS60B0 to enable one channel but requesting 128 kbps from provider ATB40 to use only one channel 64 kbps ATB0 to use both channels 128 kbps
If pppd dies after 2 min then you must change the /etc/ppp/options file 2 lines are responsible for that
lcp-echo-interval 30 lcp-echo-failure 4
Use a simple /etc/ppp/options file like
lock noauth noipdefault
Delete noauth from pppd arguments
The following is to configure ICS for a pc connected to a hub switch where LAN is connected and the Internet router also while it is the only one allowed by the router to access Internet. We will forward all incoming packets from LAN in eth0 to eth0 as if it were its own and the router does the rest For another case for example modem connection as ppp0 change the second eth0 (output) to ppp0.
For Debian do the following
Set DNS servers at /etc/resolv.conf
The main problem was IP forwarding
To test configuration we make an executable script file /usr/bin/myrouter with the following firewall instructions and then run it. To make it run on startup see section Creating_custom_service.
#!/bin/sh # This is first to clear any already existing rules /sbin/iptables -P INPUT ACCEPT /sbin/iptables -F INPUT /sbin/iptables -P OUTPUT ACCEPT /sbin/iptables -F OUTPUT /sbin/iptables -P FORWARD ACCEPT /sbin/iptables -F FORWARD # load iptables modules /sbin/modprobe iptable_nat /sbin/modprobe ip_conntrack # enable ip forwarding /bin/echo 1 > /proc/sys/net/ipv4/ip_forward # flush tables $IPTABLES -F $IPTABLES -X # enable masquerading to allow LAN internet access $IPTABLES -t nat -A POSTROUTING -o eth0 -j MASQUERADE # forward internal LAN traffic from eth0 to eth0 internet interface $IPTABLES -A FORWARD -i eth0 -o eth0 -m state --state NEW,ESTABLISHED -j ACCEPT # block out internet intrusion on eth0 #$IPTABLES -A INPUT -i eth0 -m state --state NEW,INVALID -j DROP #$IPTABLES -A FORWARD -i eth0 -m state --state NEW,INVALID -j DROP
To see which kernel you are using tupe
uname -a
Modules are usually drivers for various devices or functions of the OS. To see which modules are loaded in the kernel presently type
lsmod
To load a module
modprobe <module name>
To show info about a module
modinfo <module name>
To enable / disable modules on startup use
modconf
You can create a database of all files with
apt-get install slocate updatedb
Then search sth with locate with part of the filename you are searching as a parameter. It is extremely useful when you know the name of a file but you don't know where your linux distribution has it.
locate <name to search>
To see the disk usage of all mounted partitions
df /dev/hda8 11084456 6576484 4507972 60% / /dev/hda1 5114692 2643144 2471548 52% /mnt/hda1 /dev/hda2 4080614 1712488 2368126 42% /mnt/hda2 /dev/hda3 3076444 2589036 487408 85% /mnt/hda3 /dev/hda6 9578032 4531328 5046704 48% /mnt/hda6
Linux is an operating system with too many versions. Each one choose its own variation of the filesystem tree, storing libraries, configuration files etc to different places. So we can't create one executable for all versions of Linux. (This will improve though with LSB - Linux Standard Base. Also software in linux is highly dependable on other software or installed libraries and requires them to exist in order to work. All these problems and characteristics lead to two things.
First most linux OSs have its own packages or those from the distribution they are based on, for software installation. Second to overcome all the above problems they developed innovative packaging systems which functionality goes beyond what you knew from Windows. Common ones are
Common features are auto installation-removal of all required packages and libraries that are needed from an application to install and execute and distribution upgrade.
Ofcourse there is always the manual hard way of installing from source code, if packages don't exist for your distribution. But this should be in my opinion the last resort. Once you start using an advanced package manager like apt for example, you will forget everything else!
Apt is said to be the best package manager from all available. That's why version for rpm were developed as well. It brings power, speed, ease and most of all relibility in package management.
Additional tools for apt are apt-move and apt-proxy apt-dupdate, aptconf, auto-apt
To refresh local package database from internet repositories
apt-get update
To install or upgrade a package and all required dependencies
apt-get install package_name
To remove a package and all dependencies that will be unused afterwards
apt-get remove package_name
To upgrade entire distribution!!
apt-get dist-upgrade
If you want to simulate entire procedure without actually doing it just to see what would happen.
apt-get -s dist-upgrade > dist_test_update_.log # -s just simulates kate dist_test_update_.log # to see what would be done
To search for packages containing specific text in their names or description
apt-cache search text2find
The repositories are configured in /etc/apt/sources.list. If packages are found in more than one repositories apt tries to get them from the first repository listed and if it is unavaliable it will try the next. Here is a sample
#UNSTABLE OFFICIAL deb http://ftp.de.debian.org/debian unstable main contrib non-free deb-src http://ftp.de.debian.org/debian unstable main contrib non-free #multimedia #UNSTABLE deb http://www.debian-multimedia.org sid main deb-src http://www.debian-multimedia.org sid main #madwifi # Kanotix experimental GPG key: 71409CDF deb http://debian.tu-bs.de/project/kanotix/unstable sid madwifi deb-src http://debian.tu-bs.de/project/kanotix/unstable sid madwifi
To search for unofficial package repositories try http://www.apt-get.org/
To correct any problems with broken packages or package installations
apt-get -f install
If during any installation or download stopped on purpose or accidentally don't worry! Rerun the apt command and it will continue from where it left. Or do an apt-get -f install and rerun afterwards. Everything downloaded is in /var/cache/apt/archives/ so you can copy them in another machine. If apt finds a needed file in its cache it wont get it from the Internet and this will speed things up.
apt-get update may result in a message
Dynamic MMap ran out of room
Put this in /etc/apt/apt.conf and the problem goes away, if it reappears just increase it
APT::Cache-Limit 12582912;
Synaptic is a frontend to apt that is fun to use!
apt-get install synaptic synaptic
Some of its features
This is a frontend to dpkg in debian or rpm in Fedora/Suse/Mandrake.
You can install the required dependencies automatically!
After opening a debian package, kpackage will search the apt database and if it finds the dependencies the package says it needs it will download them and install them automatically.
alien is an utility to convert debian packages from rpm. So if you don't have a deb package do
alien package_name.rpm
It will produce a file package_name.deb. Install it with
dpkg -i package_name.deb
It will install a package only if all dependecies are met. So it must be used it after installing required dependencies with apt. To install a package
dpkg -i package_name.deb
To remove it
dpkg -r package_name.deb
To reconfigure a package already installed. (Like running setup again)
dpkg-reconfigure package-name
Source code is always available for GNU software and the steps to install from source are in most cases the same First you need to download the zipped package_name.tar.gz ή package_name.tgz file with the source code. Then execute.
tar zxvf package_name.tar.gz
If it is zipped with bzip2 it will be called package_name.tar.bz2. Execute
tar jxvf package_name.tar.bz2
It will create usually a folder with all the files inside. Cd to it and then run
./configure make su -c 'make install'
If you are lucky and its dependencies are installed on your system or it can execute without them having less functionality it will succeed. It is adviced to install all required dependencies with apt before you compile. A google search for will help.
Compiling packages is a time consuming task usually. It is adviced to replace its last step (make install) with command
checkinstall
It will create a .deb or .rpm package depending on your distribution. Next time installation will require only a simple
dpkg -i package_name.deb
or
rpm -i package_name.rpm
And it will save you time and effort.
packagesearch is another tool based on apt you must execute to install
apt-get install debtags debtags update apt-get install apt-file apt-get install curl apt-get install packagesearch
For Open Office files there are problems with greek fonts. To install new fonts use KDE control center/System Administration/Install fonts. Go from a windows installation to the windows/fonts folder and then select the fonts. Install them as root to the root folder shown there or the truetype/openoffice as an administrator to be able to be used by all users
However some documents from old office like word95 cannot be viewed even after that. For such cases install HellasArial HellasCourier fonts like we showed before and then from OpenOffice Options/font replacement enable replacing of arial to HellasArial so that replacement would be done automatically (check both always and monitor). However I must test that in practise because i don't want to mess up existing documents using arial font! The replacement font must be a good one! The true type fonts are not that good. But the afms are excellent. Install to afms folder and replace Arial → Greek Arial (Times → Greek Times (or GRTimes))
Restart Open office application to see if the problem was fixed.
Spelling works in greek and in english. From options in spelling check search in all languages. Otherwise it may be confused checking greek in english dictionary. From Tools/Spell check auto spell checker
Change also from Tools/Options/Load/Save the default type of document that OpenOffice will save to to the MS ones for compatibility. Otherwise you will be asked everytime.
When installing use -net switch to install to /opt so that it can be used by a lot of users Then run openoffice as each user to install the local profile to ~/OpenOffice.org1.1.3 Remove any preexisting folders of openoffice profiles like .openoffice (see .sversionrc)
While typing when a word is suggested to fill the remainder press ENTER to aggree
If any problems starting open office in knoppel edit the ~/.sversionrc to point to the home .openoffice folder
Wine is using windows api to run certain windows applications
apt-get install wine xwine
Run xwine to configure I configured wine from the win98 installation and changed partition2 as drive c:\ in drives and path. The following programs worked
Wine technology is a also used to port applications from linux with great success like the well known Google Earth
The messengers for linux kopete and gmail can be used to login into a lot of messenger accounts (yahoo, msn, google, irc) like it were one!
gaim is a client for gnome but integrates on kde nicely for a lot of popular messengers.
apt-get install gaim
For gmail accounts use
The kde equivalent to gaim messenger is kopete and has very advanced features install qca-tls for ssl logins
apt-get install kopete qca-tls
For gmail accounts use
For yahoo just the id and the password
try srv.irc.gr. Make a new channel server Greek IRC Network and add srv.irc.gr. and maybe others like chaos.irc.gr (good for vivodi connections). Then connect and search for a channel with a name (e.g. chat) and probably users (e.g. above 10) .Don't leave blank since it will find hundreds.
Firefox is an attractive web browser based on mozilla. From Options/Tabbed browsing uncheck Hide the tab bar when only one tab is open. Check also Load middle-clicked urls in new tabs!
The functions of firefox are extended with xpi plugins. Install them directly from Internet or save them to local dirs and open them from there. Some interesting are
To display fonts in a normal readable size on a 15-inch monitor with 800×600 resolution choose custom 60 dpi, minimum font 12 pt and normal 14pt
A package exists in debian that will automate the process
apt-get install sun-java5-plugin
Or else to install java plugin the manual way on mozilla and firefox If Mozilla is installed in this directory: /usr/lib/mozilla-1.4/
and if the JRE is installed at this directory: /usr/java/jre1.5.0 Enter the following command to create a symbolic link to the Java Plug-in for the Mozilla browser.e.g.
ln -s /usr/lib/mozilla-14/plugins/ /usr/java/jre1.5.0_01/plugin/i386/ns7/libjavaplugin_oji.so
Start Mozilla browser or restart it if it is already running. Note that if you have other Mozilla components (ie: Messenger, Composer, etc) running, you will need to restart them as well. Go to Edit > Preferences. Under Advanced category > Select Enable Java Use locate to find mozilla-firefox directories
locate mozilla-firefox
And copy there (.e.g. if it is located in /usr/lib/mozilla-firefox)
cp /usr/lib/mozilla/plugins/javaplugin_oji.so file /usr/lib/mozilla-firefox/plugins
KolourPaint reminds windows simple paint but ofcourse with more features A simple and easy-to-use paint program, with features such as basic painting (drawing diagrams and finger painting), image manipulation and icon editing. Website: http://kolourpaint.sourceforge.net
Problem that occured with xawtv - black screen - were fixed by running it once as root and then back as normal user.
The kompare program can be used to check written cds and dvds for write errors. It can compare 2 folders and a lot of other cases
First of all you need to install the corresponding package for kde translations In debian to install greek execute
apt-get install kde-i18n-el
To use multiple languages in KDE go to KDE Control Center/ Regional and Accessibility / Country Region and languages. Click add language and select the new language to add. Then move the default language to the top.
To use multiple keyboard layouts go to KDE Control Center/ Regional and Accessibility/ Keyboard Layouts. Check enable and add the language you want. From xkb options check enable and e.g. both shift keys change group. (Alt shift doesn't work for me!). Then from KDE Control Center/ Regional and Accessibility /Shortcuts, move down to switch to next keyboard layout and add a second shortcut. Press right shift + Alt to use both shift keys as the shortcut.
You can assign shortcuts to applications. Use a new scheme e.g. (myshortcuts)
knemo may pop up out of nowhere in the first kde sessions of a new user. You can run it in konqueror by putting in the address field
/usr/share/applications/kde/kcm_knemo.desktop
or if not there use locate to find it
locate kcm_knemo.desktop
or in Kde Control Center / Network / monitor Features include
Insert Quick Load from KPanel Menu. Then insert small icons for other common-used applications. Having small icons it helps saving space in kde panel.
Insert Kmix from KPanel Menu. Place mouse over there and scroll middle button to turn up/down the volume. To assign shortcuts to the up/down mute volume open the mixer right click on master volume and select shortcuts.
Restart kmix, to be sure the shortcuts are assigned.
Insert KSysGuard from KPanel Menu. Set 2-3 sensors, 1 sec interval, by dragging them there from KSysGuardd left menu. I assigned a shortcut also from KdeMenu Ctrl-Alt-home to open KSysGuard If any problems (with the xml file usually) copy it to fix it from another user like
cp /home/pepi/.kde/share/apps/ksysguard/KSysGuardApplet.xml /home/vagelis/.kde/share/apps/ksysguard/KSysGuardApplet.xml
However try only in a test user the connect command and never delete the default connection shown. I couldn't connect to a remote server nor restore the deleted local connection
Right click the task bar and select panel menu/configure/Menu and enable last used documents and search, printing system and if you lack space make zero the most used or last used application display
Check out KAppfinder. A program that searches for new installed applications and helps you insert them in the kdemenu.
To start/stop/restart/reload a service at any time in Debian
/etc/init.d/<name of service> start/stop/restart/reload
e.g. To restart printing daemon
/etc/init.d/cups restart
When system boots up, init reads the /etc/inittab configuration file. While the system is running, it will re-read it, if sent the HUP signal (from ksysguard or with command executed as root
kill -l HUP 1
this feature makes it unnecessary to boot the system to make changes to the init configuration take effect.
The services and scripts that can be executed at bootup are in /etc/init.d/ folder
Runlevels exist in the boot process in linux. When boot process is in runlevel X all the symbolic links to services that are located in folder /etc/rcX.d/ will be executed in alphabetical order. 7 are the common runlevels, see /etc/inittab for details. To switch to a runlevel while running use telinit.
telinit 1
will switch to runlevel 1
All links which name starts with Syyname start a service. The yy is inserted to define which service will start before the other and the name is the actual name of the script found in /etc/init.d/ folder
All links which name starts with Kyyname stop a service.
Always use the sysvconfig or ksysv to produce such links to preserve automation in your distribution.
See also /etc/init.d/README for details
To create a custom service there is a template file /etc/init.d/skeleton Suppose you want to create a service that enables routing (see Internet connection Sharing) that has an executable /usr/bin/myrouter. We want to name the service myrouter as well so just copy the /etc/init.d/skeleton to /etc/init.d/myrouter
cp /etc/init.d/skeleton /etc/init.d/myrouter
The file contains comments that will allow you to understand how it works. In brief we will change lines below lines :
For a description that will be outputed in boot time
DESC="Ιp forwarding and internet routing"
The name of the service and the file in /etc/init.d
NAME=myrouter
The operation to do when starting with /etc/init.d/myrouter start
do_start() { /usr/bin/myrouter
The operations to do when stopping with /etc/init.d/myrouter stop In our case we just disable ip forwarding
do_stop() { /bin/echo 0 > /proc/sys/net/ipv4/ip_forward
That's it!! Now with ksysv or sysvconfig you can enable and disable your service!
A very useful system services editor is ksysv. It uses kwrite to change batch files that control Linux services. Very powerful! Must be run logged as root. Drag and drop services to various run levels in the precedence yοu want them.
Another one that runs on console is sysvconfig. Enabling/Disabling services will make/remove all symlinks to runlevels. However some services may seem to be enabled but have no symlinks to startup runlevels. Disable and reenable a service to be sure and check then also with ksysv. Some editing must be done with ksysv also since the precedence might not be the one you wanted.
Printing is done from OpenOffice but with the below problems. I cannot set the default options. They remain US letter each time I open a document. Solution : OpenOffice.org Printer administration.
On Canon S200 The printer's head receives ink only right after plugging the printer to the cord. After 3-5 pages it starts printing empty pages as it doesn't retake any ink from the printer and uses the same already received from the first time. New driver version may solve the problem.
A quick way to setup samba is to use a sample file and change the sections to reflect your network specific details. Here is a sample smb.conf file to use samba as
# Global parameters [global] workgroup = VAGK.LOCAL map to guest = Bad User passdb backend = tdbsam #username map = /etc/samba/smbusers printcap cache time = 750 printcap name = cups add machine script = /usr/sbin/useradd -c Machine -d /var/lib/nobody -s /bin/false %m$ logon script = logon.cmd logon path = \\%N\profiles\%U logon drive = H: logon home = \\homeserver\%U\winprofile domain logons = Yes os level = 51 preferred master = Yes domain master = Yes ldap ssl = no idmap uid = 10000-20000 idmap gid = 10000-20000 printer admin = @ntadmin, root, administrator cups options = raw include = /etc/samba/dhcp.conf [homes] comment = Home Directories valid users = %S read only = No inherit acls = Yes browseable = No [users] comment = All users path = /home read only = No inherit acls = Yes veto files = /aquota.user/groups/shares/ [groups] comment = All groups path = /home/groups read only = No inherit acls = Yes [printers] comment = All Printers path = /var/tmp create mask = 0600 printable = Yes browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @ntadmin, root force group = ntadmin create mask = 0664 directory mask = 0775 [netlogon] comment = Network Logon Service path = /var/lib/samba/netlogon write list = root guest ok = Yes browseable = No [profiles] path = /var/lib/samba/profiles read only = No create mask = 0600 directory mask = 0700 [proglinux] comment = Various linux stuff path = /mnt/hda11/programslinux create mask = 0600 directory mask = 0700 guest ok = Yes case sensitive = No msdfs proxy = no [public] path = /root/public guest ok = Yes read only = No
To install
apt-get install samba
With sysvconfig or ksysv set samba to run at system startup. Be careful, nmbd must be started before smbd.
Use the above sample smb.conf file and make changes to customize to your network. Note that by default superuser in samba is root and not administrator. At first you mast set the samba root user password
smbpasswd -a root
To add a client computer named CLIENT01 use the commands
useradd CLIENT01\$ smbpasswd -a -m CLIENT01
The above smb.conf file has an auto-signing option so you might skip this part in the server and just write the desired name in the client. In fact you might have to do this if you get a message that the name of the computer is already used.
To delete a machine
smbpasswd -x -m CLIENT01 userdel CLIENT01\$
To create a new user named smbtest first create it as a standard linux user and then as a samba user
adduser smbtest smbpasswd -a smbtest
To delete an existing user (and from the local linux users also)
smbpasswd -x smbtest
With the –remove-all-files the command is rather slow since it searches for all user files (from home, samba, shared etc)but is the best. You can run it in the background
deluser --remove-all-files smbtest& rm -rf /var/lib/samba/profiles/smbtest
Make the directories that will store the profiles,netlogon and drivers. For example.
mkdir /var/lib/samba/profiles==== Samba server configuration ==== chmod 1777 /var/lib/samba/profiles/ chgrp users /var/lib/samba/profiles/ mkdir /var/lib/samba/netlogon chmod 775 /var/lib/samba/netlogon chgrp users /var/lib/samba/netlogon mkdir /var/lib/samba/drivers chmod 775 /var/lib/samba/drivers chgrp users /var/lib/samba/drivers/
Create a new template user for example template and add it in samba
adduser template smbpasswd -a template
This works but it isn't tested much yet. If any delays in displaying desktop after login rename the /netlogon/Default User folder to Default User.bak for the period you are not adding new users.
Time settings on client computers does matter, since samba loads always the most recent files among the local machine copy and the server. If machines are connected to the internet check in the clock configuration that they are all updated from the same ntp server.
To map a samba group to a unix group use commands such as
net groupmap modify ntgroup="Domain Admins" unixgroup=ntadmin net groupmap modify ntgroup="Domain Users" unixgroup=users net groupmap modify ntgroup="Domain Guests" unixgroup=nobody
What must I do to add Domain Users to the Power Users group? The Power Users group is a group that is local to each Windows 2000/XP Professional workstation. You cannot add the Domain Users group to the Power Users group automatically, it must be done on each workstation by logging in as the local workstation administrator and then using the following procedure:
To raise the debug level add the following to the smb.conf file
log level = 10 log file = /usr/local/samba/lib/log.%m include = /usr/local/samba/lib/smb.conf.%m
smbfs should be installed
apt-get install smbfs
From the console as root in order to mount to folder /mnt/samba the network folder public of the sambaserver machine (which allows guest connections)
mkdir /mnt/samba mount -t smbfs //sambaserver/public /mnt/samba -o username=guest
In the above smb.conf file there is an example section of a public samba folder To enable it in your fstab file see chapter General Linux Settings /etc/fstab
First of all try a
/etc/init.d/samba restart
It may fix things
Also in case of unusual problems from the client register the machine with the same name you want for the domain afterwards in a workgroup first (e.g. workgroup) restart and try again.
I have experienced problems after install php, mysql and apache in the client machines, probably from apache. The client machine gets the local copy of the user profile and not the roaming. Therefore you may just have to avoid installing this software, since uninstalling them want solve the problem.
Problems may occure also if client is configured via dhcp. So always test it with static IPs, dns, etc, at first.
swat is a wonderfull web-based tool for configuring samba. swat is run from inetd. You need to edit your /etc/inetd.conf and /etc/services to enable SWAT to be launched via inetd. see for details
man swat
To install
apt-get install swat
In /etc/inetd.conf you should add a line like this (not needed for Debian since the maintainer scripts do it automatically. You need to uncomment the line, though, because it is added commented out for security reasons):
swat stream tcp nowait.400 root /usr/sbin/swat swat
Use sysvconfig or ksysv to enable inetd on every startup. To test immediately
/etc/init.d/inetd start
Then from konqueror type in the address field
http://localhost:901
To connect to network pc running Windows and sharing folders or a Linux pc running samba do the following. Start LinNeighborhood. Change password and leave the workgroup field blank. Then mount the shared folder. If this doesn't work go to KDE Control Center/Network/Local browsing and change the settings with your local network settings.
In order to be able to download packages on one machine only and use them in all network client machines you must setup an apt caching server. Detailed instructions are taken from http://www.debianuniverse.com/readonline/chapter/19
After all setup below you will be able to : Execute
apt-get update
from any machine (any client or the server) and the last update packages list will be available to all other machines (clients or the server) so that any subsequent apt-get update from any client or the server will get the cached information that were previously fetched and not use the internet connection again!
Any
apt-get install packagename
from any machine (any client or the server) will get the package and put it into the server's cache so that any subsequent apt-get install packagename from any client or the server will get the cached packaged as well!
See below how all this happens!
First of all
apt-get install apt-cacher
You will need apache running
Probably the most critical things are to make sure your cache server has a fixed IP address so other computers on your network can find it, and that there is plenty of disk space because the cache itself can become quite large
Then just restart Apache by typing
/etc/init.d/apache2 restart
Check correct installation by opening in a web browser in your server machine http://localhost/apt-cacher
change options in /etc/apt-cacher/apt-cacher.conf
Comment the following line so that the cache won't get cleaned up every day
#clean_cache=1
If you don't use a proxy for http connections comment also
#http_proxy=proxy.example.com:8080
Change the following lines for allowed hosts so that nobody outside can use your bandwidth
allowed_hosts=192.168.1.0-192.168.1.255 expire_hours=120 # or more. Maybe this will avoid too much checking on the internet
Change /etc/default/apt-cacher in order to start apt-cacher at boot time
AUTOSTART=1
/var/cache/apt-cacher/packages has the package lists asked from the client computers and the deb packages also. So if you have packages in /var/cache/apt/archives you can move them to /var/cache/apt-cacher/packages for an initial speed up
cp /var/cache/apt/archives/*.deb /var/cache/apt-cacher/packages/
if the apt-cacher continues to download even if the client has cancelled try disconnecting from the internet and restarting the apt-cacher
/etc/init.d/networking stop /etc/init.d/apt-cacher stop /etc/init.d/networking start /etc/init.d/apt-cacher start
The server must complete
apt-get update
with no problems. Try to create an error-free sources.list file Add one source at a time and execute apt-get update each time.
If errors occure in a source then you may have problems. So delete the corresponding files in /var/cache/apt-cacher/packages /var/cache/apt-cacher/headers /var/cache/apt-cacher/private, possibly the lines in sources.list as well and try again if you think you will succeed this time. Do not leave incomplete files from failed fetches!!!! The clients don't seem to have problems. If the server does try using direct connection for the server's sources.list since it maybe a kind of looping problem.
The following options exist, from which the first is suggested.
To save headers and packages to the apt-cacher directories.
Dir::State::Lists "/var/cache/apt-cacher/headers"; Dir::Cache::archives "/var/cache/apt-cacher/packages";
also
mkdir /var/cache/apt-cacher/packages/partial mkdir /var/cache/apt-cacher/packages/partial
For testing purposes and for client easy setup create an /etc/apt/sources.list.default with the standard direct sources of the server and an /etc/apt/sources.list.client with the client sources. Remember to synchronize modifications to both.
Then use a copy from the one you want as sources.list. e.g.
cp /etc/apt/sources.list.default /etc/apt/sources.list
Client machines don't need to have anything installed to use Apt-cacher: they just need to have their list of package sources modified so they send their package requests to the cache server.
The list of package sources is stored in a file called '/etc/apt/sources.list'. If you open this file in a text editor such as Vim or Anjuta you'll see a number of lines that look something like this:
deb http://ftp.au.debian.org/debian unstable main contrib non-free
Each HTTP entry needs to have the address of your cache server prepended, so the example above becomes something like this:
deb http://cache.example.com/apt-cacher/ftp.au.debian.org/debian unstable main contrib non-free
You should never edit the existing client file. You should decide a sources.list.client file, test it and copy it to all clients. Then execute.
apt-get update
to tell your machine to update its package list, and you're set. Any packages you install from then on will come via the cache server.
An easy way το make such a file is to Find http: Replace with http://youraptserver.local/apt-cacher/ You cannot use ftp sources but that is a minor problem since it is rare that http sources don't exist as well The files are copied to both the cache server and to the client machine. So if the cache server doesn't delete anything the client machine can delete them from its cache, to gain disk space Sometimes the client machine asks, the cacher fetches the file and responds after it has downloaded the whole file. This is normal and the client should wait. Here is a sample taken from a client sources.list #ntua greek mirror deb http://athlon/apt-cacher/ftp.ntua.gr/pub/linux/debian/ testing main deb-src http://athlon/apt-cacher/ftp.ntua.gr/pub/linux/debian/ testing main via ftp or samba get this file from the server and copy it as /etc/apt/sources.list after you take a backup as sources.list.default. Execute cp /etc/apt/sources.list /etc/apt/sources.list.default cp /etc/apt/sources.list.client /etc/apt/sources.list ====== General Linux Settings ====== ===== /etc/fstab - mounting devices and partititions ===== There are various programs in each linux distribution to configure mounting of partitions. They all write to file /etc/fstab. I prefer to directly edit this file and make changes from a sample file. Here is a sample proc /proc proc defaults 0 0 /dev/hda8 / reiserfs notail 0 1 /dev/hda5 /mnt/hda5 reiserfs notail 0 0 /dev/hda7 none swap sw 0 0 /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0 /dev/hda1 /mnt/hda1 vfat auto,users,exec,iocharset=utf8,umask=000 0 0 /dev/hda3 /mnt/hda3 ntfs defaults,iocharset=utf8,uid=0,gid=0,auto,rw,nouser 0 0 /dev/fd0 /media/floppy vfat defaults,iocharset=utf8,user,noauto,showexec,umask=022 0 0 /dev/sda1 /mnt/sda1 vfat auto,users,exec,iocharset=utf8,umask=000 0 0 \\athlon\uploads /mnt/samba/athlon/uploads smbfs auto,username=guest,uid=1000,um ask=000,user 0 0 Let's explain some of these lines * Root partition which is reiserfs is on /dev/hda8 mounted on / * A swap in /dev/hda7 * a dvdrw in /dev/hdc mounted on /media/cdrom0 * a fat32 filesystem in /dev/hda1 mounted o /mnt/hda1 and iocharset=utf8 to support greek (or iso8859-7 for greek) * an ntfs filesystem in /dev/hda3 mounted on /mnt/hda3 as readonly * a floppy drive in /dev/fd0 mounted in /media/floppy * a usb stick (usually found in /dev/sda1) mounted in /mnt/sda1 * apt-get install smbfs to use it. A samba share ( \\athlon\uploads ) mounted on /mnt/samba/athlon/uploads as read-write For usb devices execute tail -f /var/log/messages Plug in the device and check if the usb device is found and on which device (e.g. /dev/sda1) Ntfs partitions for security reasons due to constant changes in the protocol are mounted readonly. If someone wants to test (with caution) eriting there are ways like captive-ntfs. After configuring, it only requires to change in /etc/fstab file the type from ntfs to captive-ntfs. The auto option declares that the filesystem will mount on startup. All auto entries are also mounted with mount -a To mount only one entry from fstab e.g. /dev/hda1 on /mnt/hda1 use mount /mnt/hda1 Unmount is done with umount. umount /mnt/hda1 umount -a Before you unmount close all applications that use this filesystem (konqueror tabs, editors, from console cd to another dir etc..) ===== Keyboard Shortcuts ===== General Linux Shortcuts * CTRL+ALT+BACKSPACE is to kill and restart X windows and go back to the login screen. Use it if the window manager you are using (e.g. KDE) stops responding. * ALT-CTRL-F1 .. ALT-CTRL-F6 switches view to 6 virtual consoles. The first is the one that booted your system. ALT-CTRL-F7 is where the X windows is running. If you run more than one gui session you can switch to it with ALT-CTRL-F8 and so on. Graphic views continue after the 7th. * CTRL-C to end anything you are executing in the console in the foreground (without the & at the end of the command). * CTRL-Z to postpone anything you are executing in the console in the foreground and bg command just after to put it in the background. * CTRL-D means EOF (End Of File) and is used in command like cat where you type and want to put an end. * CTRL-D also as a logout from a console (instead of command exit) KDE Shortcuts * ALT+CTRL+ESC and mouse click or ENTER on a non-responding window in KDE to kill it ===== Various configuration files ===== * /etc/issue - Output by getty before the login prompt. Press CTRL-ALT-F1 to see one. * /etc/motd - Message of the day after login in a virtual console (CTRL-ALT-F1 .. F6) or via ssh * /etc/profile - A general profile for all users. PATH is usually set here * ~/.profile and ~/.bashrc - A custom profile appended to the general one for bash shell ===== Setup quotas ===== To setup quota install quota and acl debian packages. apt-get install quota acl Change /etc/fstab as follows for the partition you want quotas and acl to be installed. If it is the root partition reboot afterwards. If you have other linux partitions test quota there since errors in mounting root partition will not allow you to boot. In such case boot from a livecd like knoppix to modify again /etc/fstab /dev/hda5 / reiserfs defaults,acl,usrquota,grpquota 0 1 * To convert from FAT,FAT32 to ntfs in a windows client execute convert c: /fs:ntfs To modify a users quota execute edquota -u smbtest #and edit the limits To show all user quotas repquota -a The same for samba shares smbcquotas -L /athlon/profiles Once one user s quota is set, it can be copied to all users for linux quotas with the edquota -p command. In this example an awk command is used to get users with a UID higher than 1000 from the /etc/passwd file: edquota -p smbtest `awk -F: '{ if ( $3 >1000 ) print $1}' /etc/passwd` You can specify that the quota that user with id 1001 has, will be set to new users in the /etc/adduser.conf file QUOTAUSER=“1001” Quotas are specific to a partition. To test acl cd /root ls /root >ls.txt ls -l total 4 -rw-r–r– 1 root root 64 Dec 8 15:19 ls.txt getfacl ls.txt # file: ls.txt # owner: root # group: root user::rw- group::r– other::r– setfacl -m smbtest:rw ls.txt getfacl ls.txt # file: ls.txt # owner: root # group: root user::rw- user:smbtest:rw- group::r– mask::rw- other::r– Perfect ! ACL's work perfectly ====== Programming ====== ===== Kylix C++ ===== To use Kylix C++ you must first install compat-glibc_6.2-3.1_i386. If you have an rpm package use alien command to generate the deb package then install the deb from kpackage. Add /usr/i386-glibc21-linux/include in the first position at Project→Options→Directories/Conditionals→… (IncludePath) and /usr/i386-glibc21-linux/lib at the lib. Check default to make it a default. Run Kylix C++ from command as /usr/local/kylix3/bin/startbcb ===== jsp -tomcat ===== To install jsp (java server pages) jacarta do the following apt-get install libervlet2.4-java tomcat5 add to your firewall script to enable port 8080 $IPTABLES -A RH-Lokkit-0-50-INPUT -p tcp -m tcp –dport 8080 –syn -j ACCEPT add also to .bashrc file (change folder names with your installation folders) JAVA_HOME=“/usr/java/j2sdk1.4.1_01/” JAVA_JRE=“/usr/java/jre1.5.0_01/” CATALINA_HOME=/usr/local/tomcat export JAVA_HOME export JRE_HOME export CATALINA_HOME To start tomcat if not in /etc/init.d/ /usr/local/tomcat/bin/startup.sh To stop /usr/local/tomcat/bin/shutdown.sh Now on addresses followed by :8080 like http://localhost/yourpage.jsp:8080 you will be able to run your jsp scripts ====== Help ====== ===== Linux and kernel documentation ===== In usr/src/linux-2.4.26/Documentation you can find documentation for several aspects of a linux system That is if you have a 2.4.26 kernel else replace it with your kernel ====== Security ====== ===== Antivirus ===== ==== clamav ==== The most popular open source but with great potentials and very large database antivirus program is clamav. It is mainly targeted on windows viruses that may reside on other partitions of the system. It has a nice front-end klamav To install in debian apt-get install klamav Database may be automatically updated from the internet. For a manual update execute freshclam ====== Troubleshooting ===== ===== Recover lost root password ===== If you lose your root password don't get desperate and format everything. Try booting from a live cd like knoppix and mount your root linux partition somewhere. For example if it is on /dev/hda5 and has an ext3 filesystem mkdir /mnt/rescue mount -t ext3 /mnt/rescue /dev/hda5 Then change the first line of the /etc/password file, that looks like: root:x:0:0:root:/root:/bin/bash into: root::0:0:root:/root:/bin/bash (With vi you just use the cursor keys to move the cursor on top of the x that has to be deleted, then hit the key x, which deletes any character under the cursor) Save and exit the file by typing [esc] :ZZ [enter] Then do: vi /mnt/rescue/etc/shadow and make the first line (that starts with root) look like this: root:*:::: (one colon, a '*' and four colons at the end). Again save and exit the file by typing [esc] :wq [enter] Reboot and log on as a normal user, then su to become root, and use the command passwd to set a password. ===== Recover lost password for a simple user ===== Recovering a passwd for a simple user is fairly easy. Just login as root and execute passwd <username> If you are using nis and the user is network user, execute yppasswd <username> Try to connect from a client pc and if this doesn't work, execute also make -C /var/yp/ If the user is a samba user execute smbpasswd -a <username> ===== Remounting read-write a readonly partition ===== A file system that is already mounted as read- only can be remounted as read- write, for example, with mount -o rw,remount /dev/hda1 / This command is useful when you log in in single-user mode with no write access to your root partition or after a failed fsck ====== Appendix ====== ===== Notes =====