Very old Linux notes

# Configure Slackware 10
# Slackware

Linux commands
# *** Useful utilities:
# uname -r : Linux kernel version
# whois domain : checks domain registry information

# date : display date
# date -s '09:40 2 Oct 2006' : set date
# links : text based web browser
# xwmconfig : select a windows manager
# liloconfig : boot setup
# ifconfig : current ip address and network settings
# 	ifconfig eth0 192.168.0.200 netmask 255.255.255.0
# nc : connect to any network port
# hostname : change the hostname, also pico /etc/HOSTNAME
# kernelversion : reports the version of the kernel
# dig : nslookup - get the dns entry for an ip etc
# sudo process : start a process as root
#	sudo su : run the root shell
#	sudo passwd : change roots passwd
# shutdown -r now : restarts the computer immediately (-h for halt)
# startx : start XWindows
# smbclient : connect to external smb shares
# 	smbclient //websrv/internet$
# removepkg packagename.tgz : removes slackware tgz software package
# fixmbr OR fdisk /mbr : WINDOWS remove lilo
# mount /dev/cdrom /cdrom : mount a CD
# mount /dev/fd0 /mnt/floppy

# gunzip  OR bunzip
# tar -zxvf mytar.tar.gz : extract tar.gz or .tgz
# tar -xvf myfile.tar
# rpm -Uvh myNewProg.rpm
# dpkg -i myNewProg.deb
# apt-get install package

# ls : list files
# cp : copy files
# mv : move/rename files
# rm : remove files
# cd : change currect directory
# pwd : list currect directory
# rmdir : remove folder
# mkdir : make folder

# adduser username : adds a user
# deluser username : deletes a user
# userdel username : deletes a user
# chage : chage password expiry

# chmod : change permissions
	chmod 777 myfile
# chown : change ownership
	chown simon myfile

# chgrp : change group ownership of the file
# gpasswd: administer the /etc/group file
# groupadd mygrp: Create a new group
# groupmod -n newgrp mygrp: Modify a group
# groupdel mygrp: Delete a new group 
# newgroup mygrp: USER change default group
# usermod -G mygrp simon: add user simon to group mygrp
# groups simon: lists groups that user simon belongs to

# cat myASCIIfile : output file to standard output (screen ... use less)
# cat | more : output file screen by screen
# less : list file (G goes to end) in a nice screen format
# locate : find a file anywhere
# updatedb : updates locate database  (sometimes locate -u)

# ps : list you processes
#	ps -ax : list all processes
# kill : stop a process
#	kill -9 154 : kills process 154
# killall : kill process by name
# bg : run process in the background (ctrl+Z)
# fg : bring background process to foreground
# top : list process interractive

# CRON
# Execute a program at a specific time / period
# Create a file with cron details in it
pico myjob.cron
# Add details of time and the program to be run
#> 0,15,30,45 * * * * /etc/rc.d/ddclient -daemon=0
# every 15 minutes run the ddclient
crontab -l


############## CONFIGURE SLACKWARE v10 #################

# Use expert mode to update the boot sequence
liloconfig


# Create the locate database
locate -u
# find things
locate smb.conf
# ignore case
locate -i smb-howto
# regular expressions
locate -r s.*HOWTO
locate -ir s[^//]*howto


# SAMBA SHARE
less /usr/doc/Linux-HOWTOs/SMB-HOWTO
less /usr/doc/Linux-HOWTOs/Samba-Authenticated-Gateway-HOWTO
# copy the smb sample to the actual conf file
cp /etc/samba/smb.conf-sample /etc/samba/smb.conf
# EDIT samba config
pico /etc/samba/smb.conf
# Change:
#>   security=share
#>   hosts allow = 192.168.1. 127.
# Add:
#> [www]
#>   path = /var/www/htdocs
#>   public = yes
#>   only guest = yes
#>   writable = yes
#>   printable = no
#>   create mask = 0777
# start the samba daemon?
/etc/rc.d/rc.samba start
# set full read write privs to the web folder
# Very naughty, but I want read/write via anonymous share
chmod 777 /var/www -R


# SAMBA USER
# This sets up specific USER access to various folders
# copy the smb sample to the actual conf file
cp /etc/samba/smb.conf-sample /etc/samba/smb.conf
# EDIT samba config
pico /etc/samba/smb.conf
# Change:
#>   security=user
#>   hosts allow = 192.168.1. 127.
# Add:
#>   netbios name = hisduv
#>   passwd program = /usr/bin/passwd '%u'
#>   passdb backend = tdbsam
# Add:
#> [www]
#>   path=/var/www/htdocs
#>   public = no
#>   only guest = no
#>   writeable = yes
#>   printable = no
#>   create mask = 0777
#>   valid users = simon root
#> Also may help:
#>   wins support = yes
#>   wins server = 152.98.228.1
/etc/rc.d/rc.samba restart


# WEB FOLDER PERMISSIONS
# This is for SAMBA SECURITY=USER (above)
# make a new group for web editors
groupadd webby
# add your users to web editors
usermod -G webby simon
usermod -G webby root
# change permissions on the web folder
chmod -R 664 /var/www/htdocs
chmod 775 /var/www/htdocs
chown -R /var/www/htdocs webby
chgrp -R webby /var/www/htdocs
# Initialise the SMB password file
touch /etc/samba/private/smbpasswd
chmod 600 /etc/samba/private/smbpasswd
chown root:root /etc/samba/private/smbpasswd
smbpasswd -w myrootpassword
smbpasswd -a simon
# smbpasswd -a myUser : adds an smbuser
# smbpasswd -d myUser : disables a user; -e to enable
# smbpasswd -x myUser : deletes a user


# Apache Options
# Stop directory listing and set index.php as a default page to load
pico /etc/apache/httpd.conf
# DirectoryIndex index.html index.php
# The following prevents folder listing (the "-" in front of "Indexes")
# 
# Options -Indexes FollowSymLinks MultiViews


# MYSQL
# Actually I tried this again - the commands below are out of order
# Change permissions on the mysql folder
chown -R mysql.mysql /var/lib/mysql
# Try starting the mysql daemon
/etc/rc.d/rc.mysqld start
# install the default database
mysql_install_db
# change the root password
/usr/bin/mysqladmin -u root password 'foobar'
# View the mysql daemon script
cat /etc/rc.d/rc.mysqld | more
# Open mysql with mysqldb and test with query
# select * from user;
mysql mysql
# If you get ERROR 1045: Access denied for user: 
mysql mysql -u root -p


# phpMyAdmin
# Excellent front end for mySQL
download http://phpMyAdmin.net
# phpMyAdmin folders
mkdir /var/www/sql
mkdir /var/www/sql/save
mkdir /var/www/sql/docsql
mkdir /var/www/sql/upload
chmod 777 /var/www/sql/*
# COPY the BOM2 sql files to cd the upload folder
cp /foobar/*.sql /var/www/sql/upload
# setup
mv phpMyAdmin-2.8.1.zip /var/www/htdocs
cd /var/www/htdocs
unzip phpMyAdmin-2.8.1
cd phpMyAdmin-2.8.1
mkdir config
chmod o+rw config
http://hisduv.sph.uq.edu.au/phpMyAdmin-2.8.1/scripts/setup.php
cp /var/www/htdocs/phpMyAdmin-2.8.1/config/config.inc.php 
/var/www/htdocs/phpMyAdmin-2.8.1/
http://hisduv.sph.uq.edu.au/phpMyAdmin-2.8.1/index.php
mysql mysql -u root -p
CREATE myphpadmin;
USE myphpadmin;
\. /var/www/htdocs/phpMyAdmin-2.8.1/scripts/create_tables.sql


# PHP Errors
less /var/log/apache/error_log


# X CONFIG
# I have mouse troubles in slackware - it always defaults to PS/2 on setup
# Select cholesterol free windows manager
xwmconfig
# start up xwindows
startx
# To config the mouse you need to start a console (usually just tap enter)
# From version 10 we use xorg and not xfree86 (xf86cfg)
xorgcfg
# set the mouse to "/dev/ttys0" and the mouse protocol to "Microsoft"
# When you quit properly you will be asked to save your settings to
# /etc/X11/xorg.conf which is good, but is not written to correctly
# you have to go in and EDIT the changes made under Mouse1
pico /etc/X11/xorg.conf
#>   Identifier  "Mouse1"
#>   Driver      "mouse"
#>   Option      "Protocol" "Microsoft"
#>   Option      "Device" "/dev/ttyS0"
#> EndS ection


# PHP
# EDIT httpd.conf to include PHP
pico /etc/apache/httpd.conf
# uncomment
#> Include /etc/apache/mod_php.conf
#> Include /etc/apache/mod_ssl.conf
/etc/rc.d/rc.httpd stop
/etc/rc.d/rc.httpd start


# DYNDNS
# Goto web site http://www.dyndns.org
# Under dynamic IP - register a domain and download a client
# ddclient
curl s90389134.onlinehome.us/ddclient/ddclient.tar.gz > ddclient.tar.gz
gunzip ddclient.gz
tar -xvf ddclient.tar
cd ddclient-3.6.3
cp ddclient /etc/rc.d
cp sample-etc_ddclient.conf /etc/ddclient.conf
pico /etc/ddclient.conf
less README
# EDIT hostnames, login, passwords
#> use=web, web=checkip.dyndns.org/, web-skip='IP Address' 
#> login=neoporcupine
#> password=blah
#> server=members.dyndns.org,              \
#> protocol=dyndns2                        \
#> neoporcupine.ath.cx,forsyth.is-a-geek.net
# to test type
/etc/rc.d/ddclient -daemon=0 -debug -verbose -noquiet
# Then EDIT /etc/rc.d/rc.M to make ddclient activate on boot up
# insert activation towards the end (before mouse?)
pico /etc/rc.d/rc.M
#> # Simon's initialisation of the DYNDNS client
#> if [ -x /etc/rc.d/ddclient ]; then
#>   /etc/rc.d/ddclient start
#> fi


# FTP // PROFTP
# Being behind a NAT has problems, check http://www.castaglia.org/proftpd
# If you did not install proftp then go to www.linuxpackages.net download the package and install
pico /etc/ftpusers
# Users who cannot ftp to the server are stored in /etc/ftpusers
# user anonymous is ftp
# remove the user ftp from /etc/ftpusers to allow anonymous access
pico /etc/inetd.conf
# Uncomment proftpd
pico /etc/proftpd.conf
# FTP config in:
#  /etc/proftpd.conf
# add the following line to set root to the www folder
# DefaultRoot /var/www/htdocs
/etc/rc.d/rc.inetd restart
# you will need to change permissions/owner/group on default folders
chmod 777 /var/www/htdocs


# SENDMAIL
pico /etc/mail/sendmail.cf
# find:
#   # "Smart" relay host (may be null)
#   DS
# Edit DS line:
#> DSmail.m.iinet.net.au
/etc/rc.d/rc.sendmail restart
# OR add the following to sendmail.mc and rebuild the sendmail.cf


# TELNET
# Should NOT use TELNET, download PuTTY - SSH telnet should already be running
# Edit the /etc/inetd.conf and uncomment telnet
pico /etc/inetd.conf
# Restart the inetd
/etc/rc.d/rc.inetd restart
# You should now be able to telnet to your linux install


# BASHRC
# To get your shell working properly, you will want to make a
# couple aliases. Here is how to make your "autoexec.bat" run
pico .bash_profile
# add the following lines
#>if [ ! "$BASHRC" -a -f ~/.bashrc ]; then
#>. ~/.bashrc
#>fi
pico .bashrc
#>alias ll='ls -la'
#>PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
#>last
#>uptime
#>free
#>