Feeds:
Berichten
Reacties

Wget

Wget -mini howto; Een kleine greep uit de schier oneindige mogelijkheden die wget de commandline liefhebber biedt. 

Met wget [1] kun je vanaf de commandline bestanden downloaden vanaf webservers.
De bestanden kunnen met wget via de volgende protocollen gedownload worden: HTTP, HTTPS, FTP en ook door HTTP proxies.
De wget connection gaat standaard via port 80 met de webserver.
Wget kan ook op de achtergrond zijn werk doen, bijv. in samenwerking met cron.

HTTP Proxies
Via een http proxie, je moet dan wat wijzigingen aanbrengen in het bestand “wgetrc”
Deze kun je vinden in “/etc/wgetrc”, en dan moet je de volgende regels aanpassen:
# You can set the default proxies for Wget to use for http and ftp.
# They will override the value in the environment.
#http_proxy = http://proxy.yoyodyne.com:8080/
#ftp_proxy = http://proxy.yoyodyne.com:8080/

Je moet het # weghalen bij http/ftp, en het juiste adres/port invullen.
“wgetrc” mag je ook naar je eigen omgeving kopieeren
$ cp /etc/wgetrc /home/user/.wgetrc

De wget basis syntax is:
wget [option]… [URL]…
Zie ook wget –help voor meer opties.

Manual [2]
Download wget [3]
Mailing List [4]
Wikipedia [6]

Download
Alle bestanden van de website worden local opgeslagen in een directory, die dezelfde naam krijgt als de website.
Tijdens de download zie je informatie over de voortgang.
$ wget http://..url..

Met de optie “-o” kun je de download info opslaan.
$ wget -o wget.log http://..url..

Dat ziet er bijv. zo uit:
johan@Debian:~/test$ cat wget.log
–19:14:29–  http://ftp.gnu.org/pub/gnu/wget/
           => `index.html.1′
           Resolving ftp.gnu.org… 199.232.41.7
           Connecting to ftp.gnu.org|199.232.41.7|:80… connected.
           HTTP request sent, awaiting response… 200 OK
           Length: unspecified [text/html]

               0K …                                                     782.69 KB/s

               19:14:30 (782.69 KB/s) – `index.html.1′ saved [3432]

Als je geen informatie tijdens de download wil zien, gebruik je
de optie “-q” quiet, een gulden middenweg is de optie “-nv” wel info
maar iets minder als normaal.

Set the time zone manually if not already set

Linux uses the file /etc/localtime to determine the time zone. This file should be either a copy of the appropriate timezone file from the directory /usr/share/zoneinfo or a symbolic link. If your time zone is incorrect, create a symbolic link to the appropriate timezone file.

# ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtimeSet whether hwclock uses local time or UTC

Edit the file /etc/sysconfig/clock and change “UTC=” to true or false. If you have a dual-boot system with Windows, using UTC may cause problems for Windows.

Set the system clock

# date MMDDhhmmCCYY.sswhere MM is month, DD is day, hh is hour, mm is minutes, CCYY is year and ss is seconds. Time should be in 24-hour notation.

To only set the time:

# date -s hh:mm:ssSet the hardware clock

To set the hardware clock to the current system clock:

# setclockthis method looks at /etc/sysconfig/clock to determine whether the hardware clock is set to UTC

Another method:

# hwclock –systohc# hwclock –systohc –utcuse the second option if you use UTC.

Set hwclock manually:

# hwclock –set –date=”9/22/96 16:45:05″
Everytime you use the hwclock –set command, it will create or edit the file /etc/adjtime to determine the systematic drift. Once you have some history, you can use the –adjust option to adjust the hardware clock appropriately. Run as a cron job if you want the clock to adjust automatically on a regular schedule. Don’t use the –adjust function when using ntpd since ntpd will turn the “11 minute mode” on, which is best left alone. See the hwclock manpage for more info.

Setup ntpd for automatic synchronization with a remote server

Run Red Hat’s setup utility to make ntpd start on boot up and edit /etc/ntp.conf

Set server and fudge options:

server time.nist.govfudge time.nist.gov stratum 10Enable multicastclient:

multicastclient # listen on default 224.0.1.1Edit /etc/sysconfig/ntpd if necessary. The default should be fine.

Start the ntpd daemonSet the time zone manually if not already set.

Linux uses the file /etc/localtime to determine the time zone. This file should be either a copy of the appropriate timezone file from the directory /usr/share/zoneinfo or a symbolic link. If your time zone is incorrect, create a symbolic link to the appropriate timezone file.
# ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtimeSet whether hwclock uses local time or UTC

Edit the file /etc/sysconfig/clock and change “UTC=” to true or false. If you have a dual-boot system with Windows, using UTC may cause problems for Windows.
Set the system clock

# date MMDDhhmmCCYY.sswhere MM is month, DD is day, hh is hour, mm is minutes, CCYY is year and ss is seconds. Time should be in 24-hour notation.

To only set the time:

# date -s hh:mm:ssSet the hardware clock

To set the hardware clock to the current system clock:

# setclockthis method looks at /etc/sysconfig/clock to determine whether the hardware clock is set to UTC

Another method:

# hwclock –systohc# hwclock –systohc –utcuse the second option if you use UTC.

Set hwclock manually:

# hwclock –set –date=”9/22/96 16:45:05″Everytime you use the hwclock –set command, it will create or edit the file /etc/adjtime to determine the systematic drift. Once you have some history, you can use the –adjust option to adjust the hardware clock appropriately. Run as a cron job if you want the clock to adjust automatically on a regular schedule. Don’t use the –adjust function when using ntpd since ntpd will turn the “11 minute mode” on, which is best left alone. See the hwclock manpage for more info.
Setup ntpd for automatic synchronization with a remote server.

Run Red Hat’s setup utility to make ntpd start on boot up and edit /etc/ntp.conf

Set server and fudge options:

server time.nist.govfudge  time.nist.gov stratum 10Enable multicastclient:

multicastclient     # listen on default 224.0.1.1Edit /etc/sysconfig/ntpd if necessary. The default should be fine.

Start the ntpd daemon

# service ntpd start

vmkfstools -i sourcedisk.vmdk destinationdisk.vmdk

Via deze link komt U op de pagina van Microsoft waar U online mijn MCSE certificering kunt kontroleren. Belangrijk is dat U de volgende gegevens invoert;
Transcript ID: 732333
Access code:
MCSE2003
U krijgt dan een overzicht te zien van mijn huidige Microsoft certificering status.

File Transfer Protocol (FTP) is een tcp protocol voor het uitwisselen van bestanden tussen computers. Het FTP protocol wordt ondersteund door veel besturingssystemen en netwerkapparatuur.

FTP werkt met een client en een server. Het server onderdeel heet een FTP daemon. Het luistert onophoudelijk naar FTP verzoeken van clients. Wanneer er een verzoek is ontvangen, zorgt de server voor de login en de start van de connectie. Tijdens de duur van de sessie voert de daemon de commando’s van de FTP client uit.

Toegang tot een FTP server kan verkregen worden op 2 verschillende manieren:

Anoniem

Geautoriseerd

In de anonieme modus, kunnen clients toegang krijgen tot de FTP server met een standaard gebruiker genaamd ‘anonymous’ of ‘ftp’. Een wachtwoord is niet nodig, maar het is een goed gebruik bij een ftp-verbinding via internet je e-mailadres als wachtwoord te gebruiken.

Een anonieme gebruiker krijgt toegang tot de map /home/ftp/. De FTP daemon zal de root map verbergen en veranderen in de FTP home map. Dit verbergt de rest van het bestandssysteem voor de anonieme ftp sessies.

Voor de geautoriseerde modus, moet de gebruiker een Ubuntu gebruikersnaam en een wachtwoord hebben. Een geautoriseerde gebruiker start in de persoonlijke map /home/gebruikersnaam. De toegang tot andere mappen is afhankelijk van de toestemmingen van de gebruiker.

vsftpd – installatie van de FTP-server
vsftpd is een FTP daemon voor Ubuntu. Het is gemakkelijk te installeren, configureren en onderhouden. Om vsftpd te installeren kan je het volgende commando gebruiken;

sudo apt-get install vsftpd

vsftpd – configuratie van de FTP-server
Je kan het vsftp configuratiebestand /etc/vsftpd.conf bewerken om de standaardinstellingen te veranderen. Standaard is alleen FTP in anonieme modus toegelaten. Als je deze optie wil deactiveren kan je de volgende regel veranderen.

anonymous enable=YES”’ in ”’anonymous enable=NO
Standaard zijn lokale Ubuntu gebruikers niet toegelaten om in te loggen op de FTP-server. Om deze instelling te veranderen kan je het #-teken weghalen voor de volgende regel.

#local_enable=Yes
Standaard hebben gebruikers toestemming om te downloaden van de FTP server. Ze hebben echter geen toestemming om bestanden te uploaden. Om deze instelling te wijzigen kan je het #-teken weghalen voor de volgende regel.

#write_enable=YES
Ook anonieme gebruikers hebben geen toestemming om te uploaden naar de FTP server. Om deze instelling te veranderen kan je het # weghalen voor de volgende regel.

#anon_upload_enable=YES
Om een eigen welkomsttekst te gebruiken haal je het #-teken weg voor de regel

#ftpd_banner=Welcome to blah FTP service.
De tekst achter het =-teken kan je naar eigen wens wijzigen. Deze aanpassing vergroot de veiligheid omdat de standaard welkomsttekst de gebruikte daemon software toont.

Het configuratiebestand /etc/vsftpd.conf bestaat uit verschillende configuratieparameters. De informatie over elke parameter is te vinden in het configuratiebestand. Je kan ook in de man pagina kijken met man vsftpd.conf voor details over elke parameter.

Als je alle instellingen gedaan hebt moet je de server herstarten met het volgende commando.

sudo /etc/init.d/vsftpd restart

Merk op dat de standaard instellingen van het configuratiebestand zijn ingesteld voor hoge veiligheid. Elk van de bovenstaande wijzigingen maken je systeem een beetje minder veilig. Stel ze alleen in als je ze nodig hebt.

Internet – TCP-poorten
Helemaal onveilig is de FTP-toegang via internet. Wil je deze toegang toch openstellen en maak je gebruik van een internet modem en/of firewall moet je de gebruikte TCP-poorten 20 en 21 doorsturen (Engels: “forwarding”) naar het netwerkadres van de computer met de FTP daemon.

Voorbereiding
Dit verhaal gaat er vanuit dat je een domein hebt geregistreerd en dat er een A (address) record met de naam 'www' bestaan. Dit address record heeft het IP adres van jouw host. Ik zal het hier over het domein www.christiaanse.net hebben. Ik ga verder niet in op de details die je moet regelen omdat voor elkaar te krijgen.

Als het allemaal goed werkt kun je een ping www.christiaanse.net geven en zien dat je antwoord krijgt.

Webserver (Apache2) installeren
Dit gaat gewoon via het mechanisme van de desbetreffende distributie. Bij mij dus; apt-get install apache2

Configureren
Nu moet er eea aan instellingen goed gezet worden; onder Ubuntu heb je nu ongeveer de volgende layout in /etc/apache2;

apache2.conf  
httpd.conf   
ports.conf
mods-enabled/  
sites-available/
sites-enabled/  
conf.d/ 
mods-available/ 
ssl/

Onder Ubuntu beheer je de apache modules met de commandos a2enmod en a2dismod. Ik zal hier niet verder ingaan op de apache modules. Dat is een verhaal op zich.

Het aan- of uitzetten van een website gaat met a2ensite en a2dissite respectievelijk.

/etc/apache2/apache2.conf
De laatste 2 regels van deze file luiden als volgt;

NameVirtualHost *:80
Include /etc/apache2/sites-enabled

Met het eerste statement geef ik aan dat ik websites heb draaien op port 80 op alle interfaces van mijn machine.

Het laatste statement verteld apache waar de website definities gevonden kunnen worden.

Maar goed - nu moet er dus nog eerst een site worden geconfigureerd. Dit doe je door de configuratie dus in sites-available te zetten.

/etc/apache2/sites-available/
In deze directory heb ik een file genaamd 'www.christiaanse.net' staan, hierin wordt aan apache vertelt hoe die website geconfigureerd is:

 1  <VirtualHost *:80>
 2          ServerAdmin
hostmaster@christiaanse.net
 3          ServerName www.christiaanse.net
 4          ServerAlias christiaanse.net
 8          ServerAlias 81.128.13.6
10          ServerSignature Off
11          DocumentRoot /home/www/www.christiaanse.net
12          LogLevel warn
13          ErrorLog /var/log/apache2/www.christiaanse.net-error.log
14          CustomLog /var/log/apache2/www.christiaanse.net-access.log combined
15  </VirtualHost>
Start een nieuwe virtualhost op port 80 (de http poort)
Wie is de admin?
Wat is de officiele hostnaam voor deze server; www.christiaanse.net
Een alias
Nog een
Idem
Idem
Idem, maar dan een IP nummer (weet niet of dit per se nodig is).
Idem
Geef geen extra informatie over de apache server (versie nummers enzo)
Waar kun je de site op het filesystem vinden? Hier dus /home/www/www.christiaanse.net
Hoeveel logging wil je hebben
En waar moet die logging heen
Idem
Einde virtual host block

a2ensite
Nu kun je met a2ensite www.christiaanse.nl voor deze file een symlink creeeren vanuit /etc/apache2/site-enabled naar /etc/apache2/site-available. Daar moet je apache restarten en zou e.e.a. moeten gaan werken;

/etc/init.d/apache2 restart

Permissies
De apache server op Debian/Ubuntu draait als user www-data, deze user moet wel recht hebben om de files in /home/miekg/miek.nl te kunnen lezen!

Ik kan nu dus een /home/www/www.christiaanse.net/index.html file aanmaken met de juiste permissies;

touch /home/www/www.christiaanse.net/index.html
chmod 644 /home/www/www.christiaanse.net/index.html

NB: ook alle tussenliggende directories moeten bewandelbaar zijn voor de 'www-data' user, anders krijg je een 'permission denied'.

Nu moet je dus je browser naar www.christiaanse.net/index.html kunnen wijzen en moet je een mooi, wit scherm krijgen. Heb je dit dan kun je daarna verder gaan met het ontwikkelen van een website.

Heb je dit niet dan kun je in /var/log/apache2/www.christiaanse.net-error.log zien of er fout-meldingen zijn verschijnen. Eventueel kun je ook /var/log/apache2/error.log bekijken.

Secure file transfers to and from local or remote systems can be initiated with the scp UNIX command.
To use the scp command to copy files between systems, use the following command:

scp filename1 userid@hostname:filename2

where filename1 is the file on the local system that you wish to copy, userid@hostname is the userid and hostname where you wish to copy it, and filename2 is the name you want to call the file on the remote system. For example:

scp myfile jdoe@wam.umd.edu:myfile

Note: SCP may also be used to copy files from a remote system to a local system. To do this in the first example above, reverse the order of filename1 and userid@hostname:filename2.

When this command is typed on the Glue system, it will copy the file to the WAM system.
When you issue the command, you’ll be prompted for the password on the remote system. You will then be given the stats of the transfer. Pay attention to the second item on the stat line; it’s how much of the file got transferred (you want to see 100%). For example:

scp myfile jdoe@wam.umd.edu:myfile
jdoe@wam.umd.edu’s password:
myfile 100% |***************************| 1232 00:00

The password will not show up when typed. The statistics indicate the percentage of the file that was transferred, the size of the file, and the estimated time to transfer the file (in this case, immediate). The scp command gives you three chances to get the password right before it aborts the connection.

To use the scp command to copy directories between systems, use the following command:

scp -r directoryname userid@hostname:directoryname2

where directoryname is the directory on the local system you wish to copy, userid@hostname is the userid and hostname where you wish to copy it, and directoryname2 is the name you want to call the file on the remote system. For example:

scp -r mydirectory jdoe@wam.umd.edu:mydirectory

Note: SCP may also be used to copy directories from a remote system to a local system. To do this in the first example above, reverse the order of directoryname and userid@hostname:directoryname2.

When this command is typed on the Glue system, it will copy the directory and all of its contents to the WAM system. The most common way to display help is at a UNIX prompt. Before you issue the scp command you can receive help at the UNIX prompt. An on-line UNIX manual is available for detailed help on scp. To access the manual information about scp, type the following at the UNIX system prompt: man scp

Voer eerste het volgende commando uit;

sudo aptitude install linux-headers`uname -r` build-essential

Download de laatste versie van Vmware workstation van de VMware website. Pak Vmware workstation uit; tar -zxvf /path/To/VMware-Workstation-xxx.tar.gz

Ga naar de folder waar VMware is uitgepakt; cd vmware-distrib

Voer het installatiescript uit; sudo ./vmware-install.pl

Houd de standaard waarden aan.

Om Vmware te starten; Applications > System Tools> VMware Workstation. Accepteer de licentieovereenkomst en voer een geldig serienummer in.

Wijzigen van de configuratie kan door het uitvoeren van het volgende script; sudo /usr/bin/vmware-config.pl

Oudere Berichten »