Linux Hints.
See also:
https://www.instructables.com/id/Linux-hints-II/
Just a few quickie ideas I put togethr that might be of interest. I have tried to keep each of them to one step.
Step 1: Install an MsWindows driver on linux.
Step 2: Message of the day,
Step 3: Library conflicts.
Step 4: Beaglebone black.
Step 5: Couple of simple simple command line clocks.
Step 6: Pogoplug V2
Step 7: Network printing.
Step 8: Create animated gifs easily
Step 9: Openwrt Chilli hotspot.
Step 10: Web and the command line working together.
Step 11: Squeezebox multimedia server.
Step 12: Firefly
Step 13: Yet another music server.
Step 14: Package group installer.
Step 15: Insecure wifi host.
Step 16.Bad b;ocl messages
Step 17 Minimal arch install starter.
Step 18 Capture the command line or ascii movies.
Step 19 Generic command line
Step 20 A few linux games
Step 21Linux for the impaired
Step 22 Linux version
Step 23 Random numbers
Step 24 Bash bug.
Step 25 Network printer install
Step 26 Command line to gui
See also: https://www.instructables.com/id/Multiple-network-cards/
Install an MsWindows Driver on Linux.
Set up a legacy mswindows wifi card in linux..(Make sure your card was installed properly while the machine was off.)
Download and extract the mswindows drivers for the card
Unzip the files to a local directory
$ unzip aw*
Fw1130.bin FwRad17.bin radio17.bin TNET1130.INF
FwRad16.bin radio16.bin tnet1130.cat tnet1130.sys
Install the interfacing software.
$ sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9 ndiswrapper-dkms
To see if your card is tetected.
$ lspci
…
00:0b.0 Network controller: Texas Instruments ACX 111 54Mbps Wireless Interface
…
$ sudo modprobe ndiswrapper
…
wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DORMANT qlen 1000
…
Install wifi card driver (driver will usually be a .INF file
$ sudo ndiswrapper -i TNET1130.INF
$ ndiswrapper -l
tnet1130 : driver installed
device (104C:9066) present
Set ip ip for the card
$ ip addr
…
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
…
Check the current config of your card.
$ iwconfig
wlan1 IEEE 802.11g ESSID:off/any
Mode:Managed Frequency:2.412 GHz Access Point: Not-Associated
Bit Rate:54 Mb/s Tx-Power:10 dBm Sensitivity=0/3
RTS thr:off Fragment thr:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
From here you should be able to configure your card.
------------------------------------------
In case you can not get the ndisrapper module:
Get kernel version
# uname -a
Append the kernel version to apt-get linux-headers-
# apt-get install linux-headers-3.2.0-4-686-pae
Get ndissrapper source
# apt-get install ndiswrapper-source
#apt-get remove
Remove the kernel setup and then reinstall
# apt-get remove ndiswrapper-dkms
# apt-get install ndiswrapper-dkms
You should see it being isntalled to the kernel.
Message of the Day,
You can also edit /etc/issue that is used by mgetty for when you log into a serial port. (rs232).
Library Conflicts.
Try
$ sudo ldconfig
$ hash -r
All si well.$ cobc -x -free ~/test.cob
$ ./test
Hello World!
Note: Many financial institutions to this day still use Cobol.
Beaglebone Black.
-----------------------------------------------------
Hints for lighting an led from bash (must be root)
#turn on light
#which pin: gpioA_B = (Ax32) + B or gpio1_6 = (1x32)+6 or 38
echo 38 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio38/direction
# turn led on
echo 1 > /sys/class/gpio//gpio38/value
# turn led off
echo 0 > /sys/class/gpio//gpio38/value
# free up pin
echo 38 > /sys/class/gpio/unexport
Downloads
Couple of Simple Command Line Clocks.
To install:
$ sudo apt-get install sysvbanner figlet
If your system sdoest not have figlet you can get it from the web.
$ wget ftp://ftp.figlet.org/pub/figlet/program/unix/figlet-2.2.5.tar.gz
$ tar zxvf figlet-2.2.5.tar.gz
$ cd figlet-2.2.5/
$ make
$ sudo make install
:Usage:
watch -tn 1 date +%T \|figlet -c
or
watch -t -n 1 "date +%T | xargs banner"
Note: just becuase your distro does not have a program, it does not mean you have to do without it. down load the source, compile the source, and then install it. Directons vary from program to program.
Pogoplug V2
Warning: do this at your own risk, There are several models of the pogoplug.and this only works on one version only of the unit. Will not be responcible for any or all issues.
Arch Linux ARM
Pogoplug v2 (Pink/Gray)
Overview and Installation
The Pogoplug v2 is the second device from CloudEngines to feature Pogoplug software. It excelled where the original Pogoplug was lacking by including 4 USB ports and a more noticeable hardware profile.
The gray Pogoplug was introduced at a later time to better fit in with users' existing components, which were not as pink as the original Pogoplug v2.
Recently, Cloud Engines has began shipping new Pink Pogoplugs with model numbers POGO-B01/02/03/04/P21 - these are completely different devices and you should NOT follow the guide on the installation tab above. Look in the "ARMv6" section for these models, or click here.
Supported Model Numbers:
POGO-E02
POGO-E02G
VERIFY YOUR MODEL NUMBER! These instructions only apply to models POGO-E02 and POGO-E02G.
These instructions will void your warranty. While every precaution is taken to ensure nothing bad happens, all actions are at your own risk.
my.pogoplug.com, the mobile applications, and the desktop Pogoplug connector will no longer work.
With the device on and online, attempt to SSH to the IP the device received through DHCP. If you are unable to SSH, register and enable SSH through my.pogoplug.com. The default login (unless changed through my.pogoplug.com) is root/ceadmin. Stop the Pogoplug software, so it doesn't interfere with the install process:killall hbwd You only need to kill the Pogoplug service the first time you SSH in. Running the installer in the following steps disables it completely. While connected via SSH to your plug, copy, paste, and run the following commands to download a bootloader that can boot from USB drives:
# cd /tmp
# wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh
# chmod +x install_uboot_mtd0.sh
# ./install_uboot_mtd0.sh
After the new bootloader is installed, you will need to use fdisk to partition a storage device. Plug in a 1GB or bigger USB drive. REMOVE ALL OTHER DRIVES. Move everything you need off of the Arch Linux ARM drive and back it up. Everything on the USB drive with be deleted and replaced with Arch Linux ARM. Set the U-Boot variable to tell the kernel to use ext3:
# /usr/sbin/fw_setenv usb_rootfstype ext3
Start fdisk on the USB drive:
# /sbin/fdisk /dev/sda
At the fdisk prompt, delete old partitions and create a new one:
Type o. This will clear out any partitions on the drive.
Type p to list partitions. There should be no partitions left.
Now type n, then p for primary, 1 for the first partition on the drive, and
then press ENTER, accepting default values.
Exit by typing w.
Now create the ext3 filesystem:
# wget http://archlinuxarm.org/os/pogoplug/mke2fs
# chmod 755 mke2fs
# ./mke2fs -j /dev/sda1
# mkdir usb
# mount /dev/sda1 usb
Download and install Arch Linux ARM:
# cd usb
# wget http://archlinuxarm.org/os/ArchLinuxARM-armv5te-latest.tar.gz
# tar -xzvf ArchLinuxARM-armv5te-*.tar.gz
This will take a long time
# rm ArchLinuxARM-armv5te-*.tar.gz
# sync
Takes a while when using a flash drive Clean up and reboot. Cross your fingers and hope for the best.
# cd ..
# umount usb
# /sbin/reboot
The SSH key of your device will be different, so you need to tell Mac OS X or Linux to remove it from ~/.ssh/known_hosts before using SSH again:
# ssh-keygen -R 192.168.1.123
Use your device's IP. Log back in after your Pogoplug reboots using username root and password root.
Installation FAQ
I ran through the installer, have everything where it should be on the USB drive, but it's still not working.
Try booting again. This often does the trick. If that does not help, try using a different USB drive. Flash drives have proven to not work well with running a full operating system, a USB hard drive is the best option.
fw_printenv/fw_setenv is no longer working.
Run the install_uboot_mtd0.sh script from within Arch Linux ARM. It will install the applications for you.
Architecture
ARMv5te
Processor
Marvell Kirkwood 1.2GHz
RAM
256MB
NAND
128MB
USB
4
Ethernet
Gigabit
Posted by Edward at 6:34 PM No comments:
Email ThisBlogThis!Share to TwitterShare to Facebook
Labels: Command. line, linux, pogoplug
Saturday, September 1, 2012
Pogoplug replugged.
Against my brothers best wishes, I bought a Pogoplug. Not sure if it is the one I asked for, but I am not complaining. Spent less than twenty dollars for it (plus shipping). Noticed the price went back up after I bought mine. Up and down so it goes. What are the specs supposed to be:
What’s in the box
Pogoplug
Power cable
Ethernet cable
Quick start guide
Limited warranty
Power requirements
100-240V, 50/60HZ
Drive connection
USB 2.0 (4 ports)
Drive Formats
NTFS, FAT32, Mac OS Extended Journaled and non-Journaled (HFS+), EXT-2/EXT-3
Network connection
Gigabit Ethernet
After getting the unit, I logged into their site and immediately registered the unit and enabled ssh so I could log into it remotely. It actually uses a minimal nix type environment, so I felt real at home tooling around in the directories. You have to log in as root since there are no user accounts per se. The first thing i did was run ifconfig to get the mac address for setting it up in the router. The second thing I did was to see what was under the hood so to speak. So It was over 1ghz speed.
$ ssh root@ipaddress
# cat /proc/cpuinfo
Processor : ARM926EJ-S rev 1 (v5l)
BogoMIPS : 1192.75
Features : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant : 0x2
CPU part : 0x131
CPU revision : 1
Cache type : write-back
Cache clean : cp15 c7 ops
Cache lockdown : format C
Cache format : Harvard
I size : 16384
I assoc : 4
I line length : 32
I sets : 128
D size : 16384
D assoc : 4
D line length : 32
D sets : 128
Hardware : Feroceon-KW
Revision : 0000
Serial : 0000000000000000
You can power it off from the command line which is probably better than just pulling the power cord.
My main goal is to modify the unit to make it a true linux box. May wait till the warranty has gone out. I will probably back up the unit first and then proceed with the linux setup. One of the most popular versions of linux is Arch and that is the one most people suggest to use on the unit. Not used Arch linux before, but I am sure it should be fairly easy to pick up. Just have to learn some new commands to do the same old thing.
Depending on what version of the unit you have, there are different instructions to set up the unit for linux. One thing is that it is a crap shoot to install linux on the units. You can very easily render them useless. You are doing it at your own risk. On the Nslu2, you do have a safety net to recover from a bad flash. This is a good time to make sure you have a good ups for the installation equipment and the pogoplug to be running on.
Anytime you plan to modify equipment, there are several steps you might want to take.
1. Get the installation directions and what files you need to download. Check and make sure they are for your unit. Double check it.
2. Search the net and look for problems and how they were solved. Check for any gotchas. Doing the research especially in support forums can save you a lot of headaches.
3. Do a walk through in your mind without ever touching any of the equipment so you have an idea of the total picture. This also verifies the instructions more than likely does not have errors. You can go back to the net and check for updates. If you have any questions you can resolve them now.
4. Make sure you have downloaded and verified all the software you will need. Not a bad idea to keep it in one place and the back it up to a place off the computer. That way you do not have a fail if your internet access becomes cut off.
5. Go back and reread the instructions again to make sure you have the gist of the project at your finger tips.
6. Make sure you are not in a hurry to do the project. Allot extra time for any possible setbacks.
7. REMAIN CALM through out the process.
8. Do it to it.
aterwards there mat b3 nore programs you want to install
$ sudo pacman-Sy bash-completion
-----------------------------------------------
Apache install ?
Update system
$ sudo pacman -Syu
Install Apache
$ sudo pacman -S apache
Open up the apache configuration file:
$ sudo nano /etc/httpd/conf/httpd.conf
Comment out the unique_id_module (you can use ctrl w to find it quickly):
#LoadModule unique_id_module modules/mod_unique_id.so
Restart Apache:
$ sudo systemctl restart httpd
(Note: If apache does not sta4rt
$ sudo systemctl enable httpd.service
$ sudo systemctl start httpd
Open up the hosts file:
$ sudo nano /etc/hosts
Add your hostname to the end of the line beginning with 127.0.0.1:
127.0.0.1 localhost.localdomain localhost droplet1
You can quickly try out a sample page by adding an index.html file to Arch’s document root directory, located within “srv/http”:
$ sudo nano /srv/http/index.html
<html>
<title>Welcome</title>
<body>
<h2>Hello, Welcome to Arch</h2>
</body>
</html>
To install MySQL, open terminal and type in these commands: (mariadb replaced mysql)
$ sudo pacman -S mysql
Hit enter if it asks you anything, unless you know you don't want the defaults.
Once you have installed MySQL, start it running
$ sudo systemctl start mysqld
Finish up by running the MySQL set up script:
sudo mysql_secure_installation
The process will ask you for your current MySQL root password (not to be confused with your server password) and, since it has not yet been set, simply press enter.
When prompted, “Set root password?” type Y, and afterwards enter in your new MySQL root password.
After that it’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
Once you're done installing MySQL, finish the LAMP stack by installing PHP.
Step Three—Install PHP
PHP is an open source web scripting language that is widely used to build dynamic webpages.
To install PHP, open terminal and type in this command.
$ sudo pacman -S php php-apache
PHP should also be added to the apache configuration file:
sudo nano /etc/httpd/conf/httpd.conf
Paste in this text block within the config.
# Use for PHP 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
Include conf/extra/php5_module.conf
Step Four—See your PHP Config and Add Programs to Startup
After LAMP is completely installed, we can take a look and see the PHP details by creating a quick php info page
To set this up, first create a new blank file:
$ sudo nano /srv/http/info.php
Add in the following line:
<?php
phpinfo();
?>
Then Save and Exit.
Restart apache so that all of the changes take effect:
$ sudo systemctl restart httpd
Visit your php info page (make sure you replace the example ip address with your correct one): http://192.168.1.28/info.php
Your screen should then look like this:
PHP info
To close out the LAMP installation, open up the configuration file of Arch’s innitscripts and add the apache server and MySQL daemons to the list of programs that run upon server startup:
$ sudo systemctl enable mysqld httpd
Congratulations, you have now installed the LAMP server on Arch Linux!
Network Printing.
You need to change a few settings. First back up your settings file.
$ sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original
Then you need to write protect the file.
$ sudo chmod a-w /etc/cups/cupsd.conf.original
And lastly you need to add settings in the settings file to let the interface be accessible.
[code]
# Only listen for connections from the local machine.
Listen localhost:631
Listen /var/run/cups/cups.sock
Listen 192.168.1.41:631 # Listen on the LAN interface, Port 631 (IPP) local host address
# Show shared printers on the local network.
Browsing Off
BrowseOrder allow,deny
BrowseAllow all
BrowseLocalProtocols CUPS dnssd
BrowseAddress @LOCAL
# Default authentication type, when authentication is required...
DefaultAuthType Basic
# Web interface setting...
WebInterface Yes
# Restrict access to the server... (to local network)
Order allow,deny
Allow from 192.168.1.*
[/code]
Just change whatever you need to. Then with your browser go to 192.168.1.41:631
Create Animated Gifs Easily
Convert a series of pictures into an animated gif is real easy. First you want to collect all the pictures together and order them by name in the order you want them to appear.
Then let’s install some software.
$ sudo apt-get install imagemagick
Now we need to make sure all the pictures are the
same size.
$ mogrify -resize 640x480 *.png
The let's make the gif. You maybe also able to do
this on other platforms, but I have not tried it
yet.
$ convert -delay 100 *.png preg.gif
View your new gif. Great for web pages and
education projects.
Imagemagick for other platforms:
<a href="http://www.imagemagick.org/download/binaries/" rel="nofollow"> http://www.imagemagick.org/download/binarie > ----------------------------------------------------------- How to quickly and easily take a short film and turn it into a gif. Make or use an empty directory for the intermediate pictures. $ mkdir gifit $ cd !$ Move the movie to that directory
Create the pictures:
$ ffmpeg -i PICT0220.AVI -r 1 -f image2 %05d.png
The pictures should all be the same size as they came from a movie.
Now let's make an animated gif
$ convert -delay 100 *.png hand.gif
Split out gif and reassemble at a slower speed.
convert a.gif %02d.png
convert -delay 6 -loop 0 *.png animation.gif
Note: check the documentation for the programs to get more possibilities.
Gifs to avi
convert test.gif old%02d.jpg
ffmpeg -r 25 -i old%02d.jpg -y -an new.avi
Downloads
Openwrt Chilli Hotspot.
1. Install Openwrt see openwrt.org
2. Upgrade the firmware from the command line by establishing an SSH session to the router.
opkg update
3. Install the necessary packages
Use the following commands
opkg install coova-chilli
Check with opkg list to see if you have kmod-tun installed. If not then you will need to install that also.
opkg install kmod-tun
you may want to use joe editor instead of the vi editor
install joe editor ('opkg install joe')
4. manually copy paste chilli. (SHIFT+Insert using joe)
joe /etc/init.d/chilli Copy our example startup file: http://hotspotsystem.com/firmware/openwrt/chilli
and save it with joe.
5. enable permissions
chmod a+x /etc/init.d/chilli
6. check your lan configuration
Openwrt
Issue ifconfig and note the names of the WAN and LAN interfaces as they appear
Openwrt
7. Edit defaults to look like the example file (it may be easier to remove the original defaults file and copy paste the new one in)
joe /etc/chilli/defaults
Copy our example "defaults" file from http://hotspotsystem.com/firmware/openwrt/defaults
and edit the lines NASIDthat should display your operatorid.
HS_LOC_ID="you hotspot's location number from the control center" HS_NASID=”your operatorid” Match the following entries beginning with
HS_WAN_IF=
LS_LANIF=
to the output of the ifconfig command from before. If the WAN and LAN interfaces appear diffferent then you will need to overwrite them.
to exit joe with saving the hit escape, then X, and type „exsave”.
Openwrt
8. Check to see if your wireless interface is turned on.
joe /etc/config/wireless
and make sure wireless interface is enabled (hash "option disabled 1")
You can change the SSID under the „option SSID”
9. REBOOT
10. when it comes back you can start chilli
/etc/init.d/chilli start
you make get the following error.
md5sum: can't open '/etc/chilli/main.conf': No such file or directory
simply start chilli again
11. Test the hotspot
When you connect wireless to the router you should now get an ip address in the 192.168.182.0 network Open a browser and try to surf the net. You will get the splash page.
12. if it works well then you can make chilli autostart.
cd /etc/rc.d
ln -s /etc/init.d/chilli s60chilli
remove dnsmasq autostart
rm /etc/rc.d/S60dnsmasq
joe /etc/rc.local
add this line:
chilli start
13. Add a cron to have device show up in the control center.
Your MAC address should appear as XX-XX-XX-XX-XX-XX and not as
XX:XX:XX:XX:XX:XX
To add a cron enter: crontab -e, and enter the following line (it should start with a number between 0-60):
00 * * * * /usr/bin/wget http://tech.hotspotsystem.com/up.php?mac=MACADDRESS\&nasid=YOUROPERATORID_YOURLOCATIONID\& uptime=`uptime|sed s/" "/\%20/g|sed s/:/\%3A/g|sed s/,/\%2C/g` -O /tmp/up.html
Press enter and save the file.
That's all. You can setup hotspot service even on a wired connection. In this case you have to choose an ethernet port instead of wlan or you can setup hotspot on both ports.
If you have successfully setup your router you have to see a login window when connecting via wireless. You can log in with username admin, blank password.
Web and the Command Line Working Together.
Squeezebox Multimedia Server.
You need two pieices of software depeding on what your system has. Our pentium II is a minimal command line headless box.Do not let the command line scare you. Once we do the install everything will be done from a web browser.
Get the squeezebox software for the 32 bit intel based computer. (http://www.mysqueezebox.com/download)
Install the software.
$ sudo dpkg -i logitechmediaserver_7.7.3_all.deb
Needed some sound libraries if you do not use your computer for multimedia.
$ wget http://www.deb-multimedia.org/pool/non-free/w/w32codecs/w32codecs_20110131-dmo2_i386.deb
Install the package.
$ sudo dpkg -i w32codecs_20110131-dmo2_i386.deb
Make a directory to hold your media,
$ sudo mikdir -P /var/media/
Copy your media files to that folder. (It is ok to use sub-folders.)
Now to the web.
Point your browser to squeezeboxhostname using a port of 9000.
In my case:
http://typo1:9000
You will need to setup a username and password if you do not already have one. There is a link to the site to do that.
Log in:
Then you can set things up to look at the directory you setup to hold your media. Then just modify the settings to what you prefer.
Save them.
Add the media to the play list. It is all point and click.
S that takes care of the server side.
Now you need to go to your media player, In my case it was an Insignia infocast with third party firmware. You will go to where the squeeeze box application is.Enter in the address of your server.
In my case it is:
http://typo1:9000/stream.mp3
Spelling is critcial here.
Now just tell your squeezebox client to play. Voila you have media. In my case it was music files.being played.
Firefly
You will need to go to the /etc directory and edit the .conf file for the music directorys. port, and passwords.
Installation instructions for forked-daapd ------------------------------------------ There are two ways to install forked-daapd: from a tarball or from the git tree. The tarball contains a working build system and pre-generated ANTLR3 parsers; the git tree doesn't and requires more tools to generate the build system and the ANTLR3 parsers. In both cases the installation procedure is the traditional ./configure; make; make install. Please read this file carefully before proceeding. System-specific requirements: - Linux: + glibc 2.13+ (bugfix: process-wide setgroups(), glibc BZ#10563) + libasound (ALSA sound support - or you can use OSS4) - FreeBSD: + OSS4 sound support + libiconv Tools: - The clang C compiler from the LLVM project. forked-daapd uses Blocks, an extension to the C language that is not supported by gcc. Along with clang, you'll also need the Blocks runtime, libblocksruntime. - pkg-config - gperf 3.x from <http://www.gnu.org/software/gperf/> Libraries: - libantlr3c (ANTLR3 C runtime, version 3.2 for tarball builds) from <http://www.antlr.org/download/C> - Avahi client libraries (avahi-client), 0.6.24 minimum from <http://avahi.org/> - sqlite3 3.5.0+ with unlock notify API enabled (read below) from <http://sqlite.org/download.html> - libav 0.6+/0.7+ (or ffmpeg 0.5.1+) from <http://libav.org/releases/> - libconfuse from <http://www.nongnu.org/confuse/> - libdispatch /!\ Read below - libtre from <http://laurikari.net/tre/download/> - libavl /!\ Read below - MiniXML (aka mxml or libmxml) from <http://minixml.org/software.php> - gcrypt 1.2.0+ from <http://gnupg.org/download/index.en.html#libgcrypt> - zlib from <http://zlib.net/> - libunistring 0.9.3+ from <http://www.gnu.org/software/libunistring/#downloading> - libflac (optional - FLAC support) from <http://flac.sourceforge.net/download.html> - taglib (optional - Musepack support) from <http://developer.kde.org/~wheeler/taglib.html> - libplist 0.16+ (optional - iTunes XML support) from <http://github.com/JonathanBeck/libplist/downloads> If using binary packages, remember that you need the development packages to build forked-daapd (usually named -dev or -devel). libdispatch for Linux and its dependencies can be found in the Debian archive; you need at least libdispatch from SVN rev 197 + Debian patches (Linux support), libkqueue 0.9.2 and libpthread_workqueue 0.7. At this time, it's probably easiest to use whatever versions happen to be in Debian unstable. libavl is not the GNU libavl. There doesn't seem to be an upstream website anymore, but you'll find the source tarball alongside the forked-daapd release tarballs (see below for the URL). Alternatively, you can fetch it from any Debian mirror, too (it'll be in /debian/pool/main/liba/libavl). sqlite3 needs to be built with support for the unlock notify API; this isn't always the case in binary packages, so you may need to rebuild sqlite3 to enable the unlock notify API (you can check for the presence of the sqlite3_unlock_notify symbol in the sqlite3 library). Refer to the sqlite3 documentation, look for SQLITE_ENABLE_UNLOCK_NOTIFY. Note about libav (ffmpeg) ------------------------- libav (ffmpeg) is a central piece of forked-daapd and most other FLOSS multimedia applications. The version of libav you use will potentially have a great influence on your experience with forked-daapd. The following versions of libav (ffmpeg) are supported and known to work: - ffmpeg 0.5.x: has issues with metadata (tags) extraction, notably with MP3 files and ID3 tags in general; - libav 0.6.x: known to work better with regard to metadata extraction; - libav 0.7.x: better yet Note that forked-daapd uses libav since the ffmpeg/libav fork during the 0.6.x series. Building from the git tree -------------------------- Gitweb: <http://git.debian.org/?p=users/jblache/forked-daapd.git> Git tree: <git://git.debian.org/users/jblache/forked-daapd.git> Required tools: - ANTLR v3 is required to build forked-daapd, along with its C runtime (libantlr3c). Use at least version 3.1.3 of ANTLR v3 and the matching C runtime version. - Java runtime: ANTLR is written in Java and as such a JRE is required to run the tool. The JRE is enough, you don't need a full JDK. - autotools: autoconf 2.63+, automake 1.10+, libtool 2.2. Run autoreconf -i at the top of the source tree to generate the build system. - gettext: libunistring requires iconv and gettext provides the autotools macro definitions for iconv. Start by generating the build system by running autoreconf -i. This will generate the configure script and Makefile.in. The configure script will look for a wrapper called antlr3 in the PATH to invoke ANTLR3. If your installation of ANTLR3 does not come with such a wrapper, create one as follows: #!/bin/sh CLASSPATH=... exec /path/to/java -cp $CLASSPATH org.antlr.Tool "@" Adjust the CLASSPATH as needed so that Java will find all the jars needed by ANTLR3. The parsers will be generated during the build, no manual intervention is needed. Building from the tarball ------------------------- Download URL: <http://alioth.debian.org/~jblache/forked-daapd/> When building forked-daapd from a release tarball, the usual ./configure; make; make install procedure applies. FLAC and Musepack support are optional. If not enabled, metadata extraction will fail on these files. Support for iTunes Music Library XML format is optional. Use --enable-itunes to enable this feature. Recommended build settings: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-flac --enable-musepack After installation, edit the configuration file, /etc/forked-daapd.conf and adjust the values at your convenience. forked-daapd will drop privileges to any user you'll specify in the configuration file if it's started as root. It's recommended to create a dedicated user without login privileges. This user must have read permission on your library (you can create a group for this and make the user a member of the group, for instance) and read/write permissions on the database location ($localstatedir/cache/forked-daapd by default). You'll need an init script if you want to start forked-daapd at boot. A simple init script will do, forked-daapd daemonizes all by itself and creates a pidfile under /var/run. Different distributions have different standards for init scripts and some do not use init scripts anymore; check the documentation for your distribution. For dependency-based boot systems, here are the forked-daapd dependencies: - local filesystems - network filesystems, if needed in your setup (library on NFS, ...) - networking - NTP - Avahi daemon The LSB header below sums it up: ### BEGIN INIT INFO # Provides: forked-daapd # Required-Start: $local_fs $remote_fs $network $time avahi # Required-Stop: $local_fs $remote_fs $network $time # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: media server with support for RSP, DAAP, DACP and AirTunes # Description: forked-daapd is an iTunes-compatible media server for # sharing your music library over the local network with RSP # clients like the SoundBridge from Roku and DAAP clients like # iTunes. It can also stream music to AirTunes devices. ### END INIT INFO
Yet Another Music Server.
Make your directories where you want your music to be and then copy them there if they are not already there. Now to install the basic software. You have the program itself (mpd) and a command line player to test it.(mpc)
$sudo apt-get install mpd mpc.
Sure sure your stereo and or speakers are attached to the sound card and they work. Now to test it. We will do it with a radio station if you do not have any music to test with.
$ mpc add http://relay3.slayradio.org:8000/
adding: http://relay3.slayradio.org:8000/
$ mpc play
You should hear the radio station out of your speakers now.
Now let's edit the config file for file location and to allow the server to be accesed from other systems. Warning this is not secure, as your better off sshing into the machine to control it.
$ sudo vim /etc/mpd.conf
Change the directory where you files are (uncomment the line also
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
# music_directory "/var/lib/mpd/music"
If you want to access the machine remotely you will need to change the hostname to the nmae of the michine, Warning: people will be albe to telnet into the machine unless you password protect the system.
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Choose any if you want
# to have mpd listen on every address
#
# For network
# bind_to_address "localhost"
Permissions:
# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# can setting can be specified multiple times for different password profiles.
#
#password "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions "read,add,control,admin"
#
###############################################################################
There are other settings, but I will let you check that out your selves..
NOw to access the system form other machines. There is a client for about every system known to man. You can check them out yourself at:
http://mpd.wikia.com/wiki/Clients
To ad a radio station, you most likely yhave to an a url.
Have fun
Package Group Installer.
Tasksel is a neat program as it will allow to install a set of programs for a specific purpose. If you only install the base (command line) system, this is a great way to add only what you need. That way you do not have to go willy nilly looking for everything that miight be needed to install a web server. What is installed will vary depending on what Debian based distro you use. This is even true between hardware platforms(i.e. X86, X86-64, Arm, PPC, and etc).
Redhat also has as a group install but it is not menu driven.
To get a list of groups
$ sudo yum grouplist | less
Then to installl
$ sudo yum groupinstall "group name"
i.e.
$ sudo yum groupupdate 'Development Tools'
On Debian and the like:
$ sudo apt-get install tasksel
You can easily select install the lamp (Linix, Apache2, Mysql, and PHP) to set up a minimal web server. While doing that you can tell the system not to install the gui desktop to make a lean and trim system. You can also install several options at once, but you need to be careful.
To see what packages a system has available to install, you can use the command: (varies from distribution to distribution). It will even tell you what is installed.
$ sudo tasksel --list-tasks
i server Basic Ubuntu server i openssh-server OpenSSH server u dns-server DNS server u lamp-server LAMP server i mail-server Mail server u openstack Openstack u postgresql-server PostgreSQL database i print-server Print server .... .... .... etc etc
You can also see what programs are included in a specific package
$ sudo tasksel --task-packages server update-notifier-common python-zope.interface python-chardet python-lazr.restfulclient python-serial w3m python-pam vim-runtime curl python-wadllib libpcsclite1 python-simplejson vim .... .... .... etc etc
You can still install and remove individual packages the old fashion way. I will not dwell on all the options, but you can always
$ man tasksel
for more details.
-------------------------------------------
Additional information:
Keep a list of installed packages:
$ dpkg –get-selections > installed-software.log read $ dpkg (dash)(dash)get-selections > installed-software.log
To use for another system: $ dpkg –set-selections < installed-software.log read $ dpkg (dash)(dash)set-selections < installed-software.log $ apt-get dselect-upgrade
Insecure Wifi Host.
>>>>>>>>>>>>>>>>>>>>>>>>>>>In progress and not finished yet <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<.
Build A Linux-Based Wireless Access Point
Today we'll learn how to convert an ordinary old PC into a powerful, customizable access point.
Wireless Adapter And Antenna
Our ordinary old PC is a Pentium 450 with 384 megabytes RAM, a 10 gigabyte hard drive, CDROM, floppy drive, two serial ports, a 10/100 PCI Ethernet adapter and video. I like leaving the video card in even though the machine will run headless; it's useful to be able to hook up a monitor for troubleshooting. This particular access point will connect wireless clients to a wired LAN. We will use the card on a PCI adapter from an earlier example. It's only 802.11bg, but it is rock-solid. We will be usng a generic extended antenna. The antenna makes a huge difference in the quality of the signal. The antenna must use the same frequency as the radio card; in this case, 2.4 GHz. Note also that a lot of cordless phones use this same frequency, and will interfere with wireless networking. In a nutshell, don't use phones that are on the same frequency as your wireless network.
Software
Install your favorite Linux, the newer the better. Be sure to install any "laptop" and "pcmcia" package groups if you are using a pcmcia wireless card. Verify that you have the following utilities installed. If you don't they are readily available from the usual sources:
Pciutils
Wireless tools
Pcmcia-cs (if you are only using pci then disregard)
HostAP driver
bridge-utils
eivf
epsduppivsnt
apt-firewall
We also installed dnsmasq to pass out ipaddresses for the nics connecting to the system. The "how to" for that is in the your own internet series,
The SSID (service set identifier) of the example access point is Northpasture, because that is the view out my window. SSIDs can be up to 32 characters and are case-sensitive.
Debian Configuration
Debian provides several ways to configure wireless adapters. The simplest is to use /etc/network/interfaces. Add this entry, using your own network addresses and ESSID:
Card may be different. sudo lshw -C network will let you know the card address eth?
auto eth1
iface eth1 inet static
address 192.168.1.5
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
wireless_essid youressid
wireless_mode Master
# wireless_mode ad-hoc
You can put any iwconfig command in this file, in the format wireless_[command] [value], except nick.
Red Hat Configuration
On Red Hat, Fedora, Mandrake, White Box Linux, and all the other Red Hat clones and offshoots, edit /etc/sysconfig/network-scripts/ifcfg-eth1:
DEVICE=eth1
USERCTL=yes
TYPE=wireless
HWADDR=00:20:e0:8f:ea:44
BOOTPROTO=static
IPADDR=192.168.1.5
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
ONBOOT=yes
MODE=Master
ESSID=Northpasture
Restart networking (sudo service networking restart) Now you should be able to connect from a wireless client. A quick and easy test is to configure the client with a static IP, set the ESSID to be the same as the access point, and put it in MANAGED mode. You should be able ping from both machines.
Adding WEP
The Senao 2511 only supports WEP (wireless equivalent privacy) in Linux. WEP is regarded as feeble, but it's better than nothing. A much stronger solution is to tunnel all wireless traffic using OpenVPN, which will be covered in a future article. (Don't wait for me -- OpenVPN is fairly simple to use, yet sophisticated and secure.)
All you need to do is cobble up a 104-bit hexadecimal key, then share this key with the access point and all clients. Use dd and xxd to generate a reasonably randomized number:
$ dd if=/dev/random bs=1 count=13 2>/dev/null |xxd -ps
d47c190ffd9dd7936f08eedc0e
On Debian, copy the key into /etc/network/interfaces:
wireless_key d47c190ffd9dd7936f08eedc0e
On Red Hat et al, copy the key into /etc/sysconfig/networking/devices/keys-eth1:
KEY=d47c190ffd9dd7936f08eedc0e
You are limited by the weakest level of WEP support, so if you have any clients that support only 64-bit, that's what you'll have to use. Adding to the fun is sometimes 64-bit really means 40-bit; see "Making the Most from WEP" to help make sense of it all. Most security howtos recommend that you change the key weekly. This is a great way to use up all that free time you've been burdened with, because it must be done manually on every PC. The assumption is that a determined cracker is intercepting your transmissions and running a cracking tool against your keys. It could happen, better to be careful.
Once you have verified that everything works, it's time to move on to the next step, which paradoxically undoes much of what you just did.
Building A Bridge
The next step is to set up bridging between the wireless adapter and the wired Ethernet adapter. Bridging must be supported in the kernel, and most likely it isn't on a stock Debian installation. It should be present on Red Hat and Fedora and the rest of the Red Hat gang. Look in the /boot/config file for CONFIG_BRIDGE=m or =y. If it isn't, you'll have to build a new kernel. When you are configuring the new kernel look for Device Drivers -> Networking Support -> Networking Options -> 802.1d Ethernet Bridging.
You should also install the kernel-unsupported package on Red Hat-ish systems, and make sure it matches your kernel version (uname -r). This contains the bridge.o module, which may be needed by bridge-utils. If you get the "br_add_bridge: Package not installed" error message when you try to set up the bridge, kernel-unsupported will fix it.
Once all that is squared away, run these commands to set up the bridge:
# ifconfig eth0 0.0.0.0 down
# ifconfig eth1 0.0.0.0 down
# brctl addbr br0
# brctl addif br0 eth0
# brctl addif br0 eth1
# brctl stp br0 off
# ifconfig br0 192.168.1.5
# ifconfig eth0 up
# ifconfig eth1 up
This may look mysterious, but it's not so bad: first the two NICs must be shut down and their IP addresses removed. Then the bridge is created at br0, the two interfaces are added to the bridge, and the bridge is started with an IP address of 192.168.1.5. "brctl stp br0 off" turns off the Spanning Tree protocol, which is not needed when there is only a single bridge.
To view your bridge configuration:
# brctl show
You don't have to use bridging; you may use routing instead, or indeed any type of exotic networking you wish.
You now have a real-live wireless access point, and wireless clients should be able to access the wired LAN. Stay tuned for future installments on adding heavier-duty security and access controls, roaming, and network monitoring with Kismet.
What About wlan0
When you see documentation that refers to wireless adapters as something like wlan0 instead of eth0, that means they are using the Linux WLAN tools. WLAN is older than Wireless-tools and not as featureful; better to use Wireless-tools if you can.
----------------------------------------------------
Wicd
You must remove network-manager to get wicd to work. Check to see if network-manager is installed and see if, after you installed the driver, your wireless is already working in the notification area of your desktop manager. You may already be good to go.
wicd (Wireless Interface Connection Daemon) is a lightweight alternative to NetworkManager. It is environment-independent, making it suitable for all desktop environments, including GNOME, Xfce, LXDE, and Fluxbox. Like NetworkManager, wicd is configured via a graphical interface. Your wireless interface should not be referenced within Debian's /etc/network/interfaces file.
-
Update the list of available packages and install the wicd package:
$ su # aptitude update # aptitude install wicd
-
Amend /etc/network/interfaces to contain only the following:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback
Note: as of wheezy it is fine to have your wireless interface in /etc/network/interfaces (it might even be required, not sure)
-
If not already performed, add your regular user account to the netdev group and reload DBus:
# adduser yourusername netdev # /etc/init.d/dbus reload
-
Start the wicd daemon:
# /etc/init.d/wicd start
-
Start the wicd GUI with your regular user account:
# exit $ wicd-client -n
See also wicd frequently asked questions.
Command Line
Scan for available networks and get network details:
$ su # iwlist scan
Now edit /etc/network/interfaces. The required configuration is much dependent on your particular setup. See the following example to get an idea of how it works:
# my wifi device auto wlan0 iface wlan0 inet dhcp wireless-essid [ESSID] wireless-mode [MODE]
For further information on available configuration options, see man interfaces, man wireless and /usr/share/doc/wireless-tools/README.Debian.
You can now bring your interface up and down with the usual ifup and ifdown commands. If you added auto wlan0 as in the example above, the interface should be brought up automatically during boot up.
wpa_supplicant
wpa_supplicant is a WPA client and IEEE 802.1X supplicant.
The wpasupplicant package provides wpa-* ifupdown options for /etc/network/interfaces. If these options are specified, wpa_supplicant is started in the background when your wireless interface is raised and stopped when brought down.
-
GNOME and KDE users shouldn't configure wpa_supplicant manually. Use NetworkManager as explained above.
Before continuing, install the wpasupplicant package:
-
$ su # aptitude update # aptitude install wpasupplicant
WPA-PSK and WPA2-PSK
Also known as "WPA Personal" and "WPA2 Personal" respectively.
-
Restrict the permissions of /etc/network/interfaces, to prevent pre-shared key (PSK) disclosure:
# chmod 0600 /etc/network/interfaces
-
Open /etc/network/interfaces in a text editor:
# sensible-editor /etc/network/interfaces
-
Define appropriate stanzas for your wireless interface, along with the SSID and PSK. For example:
auto wlan0 iface wlan0 inet dhcp wpa-ssid mynetworkname wpa-psk mysecretpassphrase
The "auto" stanza will bring your interface up at system startup. If not desired, remove or comment this line. - Save the file and exit the editor.
-
Bring your interface up. This will start wpa_supplicant as a background process.
# ifup wlan0
Additional wpa-* options are described within /usr/share/doc/wpasupplicant/README.modes.gz. This should also be read if connecting to a network not broadcasting its SSID.
For general /etc/network/interfaces information, see the interfaces(5) man page.
WPA-EAP
For networks using EAP-TLS, you are required to establish a wpa_supplicant configuration file and provide the client-side certificate. An example WPA2-EAP configuration file can be found at /usr/share/doc/wpasupplicant/examples/wpa2-eap-ccmp.conf.
Once available, reference your configuration file in /etc/network/interfaces. For example:
-
auto wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
More information can be found in the wpa_supplicant.conf(5) man page. A fully-commented wpa_supplicant configuration file example is at /usr/share/doc/wpasupplicant/README.wpa_supplicant.conf.gz.
Switching Connections
To switch between multiple distinct configurations:
-
GNOME users should use "Menu System > Administration > Network". (n.b. this doesn't work in etch)
- Console users can
-
use logical interfaces, as
iface wlan_home inet dhcp wpa-ssid mynetworkname wpa-psk mysecretpassphrase
# ifup wlan0=wlan_home
-
use ifscheme, see the example configuration at alwayssunny.com.
-
You can use guessnet(8) to switch profiles automatically by your location.
-
Security consideration
-
Every member of a network can listen to other members' traffic (whether it's an unencrypted public hot-spot, or a WEP/WPA/WPA2, or LAN). Use SSL/TLS protocols (HTTPS, IMAPS...) or VPN to preserve your privacy.
- WEP is so insecure that it is basically equivalent to not using any encryption at all.
-
WPA1 is deprecated. Use WPA2 instead.
-
Make sure you use a strong pass-phrase.
Bad Block Messages.
----------------------------
"Bad block messages" usually happens when drives will not mount or boot completely.
Checkout error for sure
dmesg | tail
[ 4324.292510] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[ 4324.292521] sd 3:0:0:0: [sdb] Attached SCSI disk
[ 4327.713599] EXT4-fs (sdb1): ext4_check_descriptors: Checksum for group 1536 failed (18982!=0)
[ 4327.713612] EXT4-fs (sdb1): group descriptors corrupted!
[ 4331.946594] EXT4-fs (sdb1): ext4_check_descriptors: Checksum for group 1536 failed (18982!=0)
[ 4331.946607] EXT4-fs (sdb1): group descriptors corrupted!
[ 4342.836612] EXT4-fs (sdb1): ext4_check_descriptors: Checksum for group 1536 failed (18982!=0)
[ 4342.836625] EXT4-fs (sdb1): group descriptors corrupted!
[ 4600.601626] EXT4-fs (sdb1): ext4_check_descriptors: Checksum for group 1536 failed (18982!=0)
[ 4600.601637] EXT4-fs (sdb1): group descriptors corrupted!
Get back up blocks (if any) so problem can be resolved. sudo mke2fs -n /dev/xxx
$ sudo mke2fs -n /dev/sdb1
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
15007744 inodes, 60001024 blocks
3000051 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1832 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Run the fix. Takes an eon. Battery backup required. sudo e2fsck -b block_number /dev/xxx
$ sudo e2fsck -b 23887872 /dev/sdb1
---
---
Group descriptor 1825 checksum is invalid. FIXED.
Group descriptor 1826 checksum is invalid. FIXED.
Group descriptor 1827 checksum is invalid. FIXED.
Group descriptor 1828 checksum is invalid. FIXED.
Group descriptor 1829 checksum is invalid. FIXED.
Group descriptor 1830 checksum is invalid. FIXED.
Group descriptor 1831 checksum is invalid. FIXED.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 10882413 has zero dtime. Fix<y>? yes
Pre-uefi Systems Remote Arch Linux Install Preparation
I am assuming you now how to download and burn the arch linux cd.
https://www.archlinux.org/download/
http://mirrors.gigenet.com/archlinux/iso/2014.01.05/
Index of /archlinux/iso/2014.01.05
Name | Last modified | Size | Description | |
---|---|---|---|---|
| ||||
Parent Directory | - | |||
arch/ | 05-Jan-2014 03:26 | - | ||
archlinux-2014.01.05-dual.iso | 05-Jan-2014 03:41 | 528M | ||
archlinux-2014.01.05-dual.iso.sig | 05-Jan-2014 03:41 | 287 | ||
archlinux-2014.01.05-dual.iso.torrent | 05-Jan-2014 03:41 | 30K | ||
archlinux-bootstrap-2014.01.05-i686.tar.gz | 05-Jan-2014 03:42 | 75M | ||
archlinux-bootstrap-2014.01.05-i686.tar.gz.sig | 05-Jan-2014 03:42 | 287 | ||
archlinux-bootstrap-2014.01.05-x86_64.tar.gz | 05-Jan-2014 03:44 | 77M | ||
archlinux-bootstrap-2014.01.05-x86_64.tar.gz.sig | 05-Jan-2014 03:44 | 287 | ||
md5sums.txt | 05-Jan-2014 03:44 | 220 | ||
sha1sums.txt | 05-Jan-2014 03:44 | 244 | ||
|
Of course I had already installed arch linux on the pogoplug a while back.
Boot the arch minimal iso in the target machine.and at the oot prompt change the password
# passwd
root@archiso ~ # passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@archiso ~ #
See if you have an internet connectio
root@archiso ~ # ping -c 1 www.google.com
PING www.google.com (74.125.198.106) 56(84) bytes of data.
64 bytes from og-in-f106.1e100.net (74.125.198.106): icmp_seq=1 ttl=44 time=20.5 ms
--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 20.597/20.597/20.597/0.000 ms
root@archiso ~ #
See what the name of your nic card is to the system
root@archiso ~ # dmesg | grep eth
[ 37.369974] systemd-udevd[178]: renamed network interface eth0 to enp0s12
Get get the ip address
# ip addr show dev enp0s12
2: enp0s12: mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 00 00 00 00 00 00 00 brd ff:ff:ff:ff:ff:ff
inet 192.168.8.127/24 brd 192.168.8.255 scope global enp0s12
valid_lft forever preferred_lft forever
inet6 fe80::210:5aff:fe19:fd88/64 scope link
valid_lft forever preferred_lft forever
Start the ssh session
# systemctl start sshd
Go to a remote machine and log in (since root is the only user, you have to log in as root)
$ ssh root@192.168.8.127
The authenticity of host '192.168.8.127 (192.168.8.127)' can't be established.
ECDSA key fingerprint is (a bunch of hex numbers).
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.8.127' (ECDSA) to the list of known hosts.
root@192.168.8.127's password:
Last login: Fri Jan 10 03:27:12 2014 from remotecomputer
root@archiso ~ #
Now you can turn off the monitor to the machine to be installed to save a bit of power. From here you can follow any number of arch linux command line install pages:
https://wiki.archlinux.org/index.php/Beginners%27_Guide/Installation
Skip past the network install since it is already working.
Command Line Recorder.
Sometimes every once in a while, you find an old generally unused command, but now you find it is very valuable. One such command is know as ttyrec. As the name suggests, you can probably record what is typed at the terminal. This is excellent for documentation purposes. It is a must for people who do any amount of work on the command line. An example: recently did a remote install of Arch linux on a remote machine. It would have been nice to have a record of all the work done.
Well how do you use it? There are actually two parts of the system. ttyrec does the recording and ttyplay will playback what you have recorded. So you will want to invoke ttyrec with a filename (for later playback,) which will generate a new shell or prompt. Go ahead and trpe in the coomands you want to do, then when you are finnished, use d to exit the the recording. You will see the word exit to confirm the exit of the ttyrec program.
$ sudo apt-get install ttyrec
$ ttyrec filename
$ echo hello world
hello world
$d exit
Now to playback what your have typed in exactly as you have typed it then use:
$ ttyshow filename
The playback will show everything as it was done like a movie.Now anytime you want to check out what you did during the recording session, it is at your fingertips. Also too makes for great educational media.
also perfect for recording online sessions say like using telnet.
$ ttyrec starwars
$ telnet towel.blinkenlights.nl
control-d
$ ttyplay starwars.
Generic Command Line Programs. Your Distro May Vary.
$ uname –a => Display linux system information
$ uname –r => Display kernel release information (refer uname command in detail)
$ cat /etc/redhat_release => Show which version of redhat installed
$ uptime => Show how long system running + load (learn uptime command)
$ hostname => Show system host name
$ hostname -i => Display the IP address of the host (all options hostname)
$ last reboot => Show system reboot history (more examples last command)
$ date => Show the current date and time (options of date command)
$ cal => Show this month calendar (what more in cal)
$ w => Display who is online (learn more about w command)
$ whoami => Who you are logged in as (example + sreenshots)
$ finger user => Display information about user (many options of finger command)
2. Hardware
$ dmesg => Detected hardware and boot messages (dmesg many more options)
$ cat /proc/cpuinfo => CPU model
$ cat /proc/meminfo => Hardware memory
$ cat /proc/interrupts => Lists the number of interrupts per CPU per I/O device
$ lshw => Displays information on hardware configuration of the system
$ lsblk => Displays block device related information in Linux (sudo yum install util-linux-ng)
$ free -m => Used and free memory (-m for MB) (free command in detail)
$ lspci -tv => Show PCI devices (very useful to find vendor ids)
$ lsusb -tv => Show USB devices (read more lsusb options)
$ lshal => Show a list of all devices with their properties
$ dmidecode => Show hardware info from the BIOS (vendor details)
$ hdparm -i /dev/sda # Show info about disk sda
$ hdparm -tT /dev/sda # Do a read speed test on disk sda
$ badblocks -s /dev/sda # Test for unreadable blocks on disk sda
3. Statistics
$ top => Display and update the top cpu processes (30 example options)
$ mpstat 1 => Display processors related statistics (learn mpstat command)
$ vmstat 2 => Display virtual memory statistics (very useful performance tool)
$ iostat 2 => Display I/O statistics (2sec Intervals) (more examples)
$ tail -n 500 /var/log/messages => Last 10 kernel/syslog messages (everyday use tail options)
$ tcpdump -i eth1 => Capture all packets flows on interface eth1 (useful to sort network issue)
$ tcpdump -i eth0 'port 80' => Monitor all traffic on port 80 ( HTTP )
$ lsof => List all open files belonging to all active processes.(sysadmin favorite command)
$ lsof -u testuser => List files opened by specific user
$ free –m => Show amount of RAM (daily usage command)
$ watch df –h => Watch changeable data continuously(interesting linux command)
4. Users
$ id => Show the active user id with login and group(with screenshot)
$ last => Show last logins on the system (few more examples)
$ who => Show who is logged on the system(real user who logged in)
$ groupadd admin => Add group "admin" (force add existing group)
$ useradd -c "Sam Tomshi" -g admin -m sam => Create user "sam" and add to group "admin"(here read all parameter)
$ userdel sam => Delete user sam (force,file removal)
$ adduser sam => Add user "sam"
$ usermod => Modify user information(mostly useful for linux system admins)
5. File Commands
$ ls –al => Display all information about files/ directories(20 examples)
$ pwd => Show current directory path(simple but need every day)
$ mkdir directory-name => Create a directory(create mutiple directory)
$ rm file-name => Delete file(be careful of using rm command)
$ rm -r directory-name => Delete directory recursively
$ rm -f file-name => Forcefully remove file
$ rm -rf directory-name => Forcefully remove directory recursively
$ cp file1 file2 => Copy file1 to file2 (15 cd command examples)
$ cp -r dir1 dir2 => Copy dir1 to dir2, create dir2 if it doesn’t exist
$ mv file1 file2 => Move files from one place to another(with 10 examples)
$ ln –s /path/to/file-name link-name => Create symbolic link to file-name (examples)
$ touch file => Create or update file (timestamp change)
$ cat > file => Place standard input into file (15 cat command examples)
$ more file => Output the contents of file (help display long tail files)
$ head file => Output the first 10 lines of file (with different parameters)
$ tail file => Output the last 10 lines of file (detailed article with tail options)
$ tail -f file => Output the contents of file as it grows starting with the last 10 lines
$ gpg -c file => Encrypt file (how to use gpg)
$ gpg file.gpg => Decrypt file
6. Process Related
$ ps # Display your currently active processes (many parameters to learn)
$ ps aux | grep 'telnet' # Find all process id related to telnet process
$ pmap # Memory map of process (kernel,user memory etc)
$ top # Display all running processes (30 examples)
$ kill pid # Kill process with mentioned pid id (types of signals)
$ killall proc # Kill all processes named proc
$ pkill processname # Send signal to a process with its name
$ bg # Resumes suspended jobs without bringing them to foreground (bg and fg command)
$ fg # Brings the most recent job to foreground
$ fg n # Brings job n to the foreground
7. File Permission Related
$ chmod octal file-name # Change the permissions of file to octal , which can be found separately for user, group and world
octal value (more examples)
4 - read
2 – write
1 – execute
Example
$ chmod 777 /data/test.c # Set rwx permission for owner , rwx permission for group, rwx permission for world
$ chmod 755 /data/test.c # Set rwx permission for owner,rw for group and world
$ chown owner-user file # Change owner of the file (chown more examples)
$ chown owner-user:owner-group file-name # Change owner and group owner of the file
$ chown owner-user:owner-group directory # Change owner and group owner of the directory
Example
$ chown bobbin:linoxide test.txt
$ ls -l test.txt
-rw-r--r-- 1 bobbin linoxide 0 Mar 04 08:56 test.txt
8. Network
$ ifconfig –a # Display all network ports and ip address (set mtu and other all options)
$ ifconfig eth0 # Display specific ethernet port ip address and details
$ ip addr show # Display all network interfaces and ip address(available in iproute2 package,powerful than ifconfig)
$ ip address add 192.168.0.1 dev eth0 # Set ip address
$ ethtool eth0 # Linux tool to show ethernet status (set full duplex , pause parameter)
$ mii-tool eth0 # Linux tool to show ethernet status (more or like ethtool)
$ ping host # Send echo request to test connection (learn sing enhanced ping tool)
$ whois domain # Get who is information for domain
$ dig domain # Get DNS information for domain (screenshots with other available parameters)
$ dig -x host # Reverse lookup host
$ host google.com # Lookup DNS ip address for the name (8 examples of host command)
$ hostname –i # Lookup local ip address (set hostname too)
$ wget file # Download file (very useful other option)
$ netstat -tupl # Listing all active listening ports(tcp,udp,pid) (13 examples)
9. Compression / Archives
$ tar cf home.tar home # Create tar named home.tar containing home/ (11 tar examples)
$ tar xf file.tar # Extract the files from file.tar
$ tar czf file.tar.gz files # Create a tar with gzip compression
$ gzip file # Compress file and renames it to file.gz (untar gzip file)
10. Install Package
$ rpm -i pkgname.rpm # Install rpm based package (Installing, Uninstalling, Updating, Querying ,Verifying)
$ rpm -e pkgname # Remove package
Install from source
./configure
make
make install (what it is)
11. Search
$ grep pattern files # Search for pattern in files (you will this command often)
$ grep -r pattern dir # Search recursively for pattern in dir
$ locate file # Find all instances of file
$ find /home/tom -name 'index*' # Find files names that start with "index"(10 find examples)
$ find /home -size +10000k # Find files larger than 10000k in /home
12. Login (ssh and telnet)
$ ssh user@host # Connect to host as user (secure data communication command)
$ ssh -p port user@host # Connect to host using specific port
$ telnet host # Connect to the system using telnet port
13. File Transfer
scp
$ scp file.txt server2:/tmp # Secure copy file.txt to remote host /tmp folder
$ scp nixsavy@server2:/www/*.html /www/tmp # Copy *.html files from remote host to current system /www/tmp folder
$ scp -r nixsavy@server2:/www /www/tmp # Copy all files and folders recursively from remote server to the current system /www/tmp folder
rsync
$ rsync -a /home/apps /backup/ # Synchronize source to destination
$ rsync -avz /home/apps linoxide@192.168.10.1:/backup # Synchronize files/directories between the local and remote system with compression enabled
14. Disk Usage
$ df –h # Show free space on mounted filesystems(commonly used command)
$ df -i # Show free inodes on mounted filesystems
$ fdisk -l # Show disks partitions sizes and types(fdisk command output)
$ du -ah # Display disk usage in human readable form (command variations)
$ du -sh # Display total disk usage on the current directory
$ findmnt # Displays target mount point for all filesystem
$ mount device-path mount-point # Mount a device
15. Directory Traverse
$ cd .. # To go up one level of the directory tree(simple & most needed)
$ cd # Go to $HOME directory
$ cd /test # Change to /test directory
A Few Linux Games.
A few linux games you may or many not know about.
http://www.cahilig.net/2011/07/29/100-best-free-and-high-quality-linux-games
Visually Impaired.
Sometimes I forget how lucky I am to see. Not everyone has that gift. If you do not have that gift, does not mean you should be limited in using computers. Traditionally you had to let someone install linux for you, Several Linux distros now allow even the seeing and or hearing impaired to install and use Linux. As a test for myself, I took the Debian linux distro to see if I could install and use it blindfolded. As many times as I have done the text install of Linux, I did not do very well with the audio commanded install of Debian Linux (www.debian.org). I am sure they have improved it. Then again they mever advertized it as a distro for the blind. (You use the speech synthesis option). Later you might need to install Orca if you want to use the gui.
But then you can use the distros meant to be used for the handicapped such as Arch (http://talkingarch.tk/). They even have an audio not video tutorial. You could also use Vinux (vinuxproject.org/) or Sonar (http://sonargnulinux.com/). Sonar is recommeded byt the TLLTS podcast team.
There are some excellent text based utilities to start of with before you venture into the gui.
Some of my favorite programs are:
alsa sound modules – music and to support speech programs (and voice recording)
Twidge – twitter client
links2 – internet browser
ps2ascii – convert postscript files to text files.
bashpodder – audio podcast collector
alpine sendEmail – email client tools
irssi – interrelay chat
centerim – instant messaging client
vim can be used as and editor or word processor, there are many others.
antiword – for dealing with proprietary word procesing formats.
screen – allows you to easily switch remote sessions
ledger – accounting program
curl wget – web page and file extracting tools
bash – the built in programming language that can be used with awk, sed, sort tr figlet (make your own database or game programs as well as other tools).
ImageMagick suite – manipulate graphics
cadubi tetradraw – ascii drawing programs
opensched – schedule formater.
hnb – notetaking and outlining
moc mplayer aplay ffmpeg – audio tools and players.
nget newbueter – newsreader
pal – calendar/planner program
cdrecord – burn cd’s and back up computer.
ssh and other tools. – network administration/file amangement
espeak festival – voice synthesis (great for having your computer read outloud documents) Who needs a Kindle?
wyrd - calendaring program.
The bottom line is that you can do word processing. spreadsheets. database, email, listen to podcasts or even hear documents spoken. Who could ask for more? Happy computing
Linux Version?
Download file
$ chmod +x release.sh
$ ./release.sh
Ubuntu 12.04.4 LTS
$ ./release.sh
Arch Linux
Downloads
Random Numbers.
Play the lottery? Here is a simple random number generator to pontificate the numbers. Run it as many times as there are picks.<br> lg.sh: echo Lottery generator echo echo -n "Enter number of balls: " read nodf echo -n "Enter number of choices: " read b declare -i X=$b for i in $(seq 1 1 $nodf) do NUM=$[ ( $RANDOM % $X ) + 1 ]; echo "The winner is for ball number $i:" $NUM done $ ./lg.sh Lottery generator Enter number of balls: 5 Enter number of choices: 50 The winner is for ball number 1: 32 The winner is for ball number 2: 43 The winner is for ball number 3: 23 The winner is for ball number 4: 18 The winner is for ball number 5: 38 Don't forget to "chmod +x" it. Great for choosing winners randomly in a contest. Write the number down after each toss. I will let you mod the code to save the numbers. Note: it does not check for duplicates. <p>lg.sh:> echo Lottery generator echo echo -n "Enter number of balls: " read nodf echo -n "Enter number of choices: "read b</p><p>declare -i X=$b</p><p>for i in $(seq 1 1 $nodf)</p><p>do</p><p>NUM=$[ ( $RANDOM % $X ) + 1 ];</p><p>echo "The winner is for ball number $i:" $NUM</p><p>done</p><p>$ ./lg.sh Lottery generator Enter number of balls: 5 Enter number of choices: 50 The winner is for ball number 1: 32 The winner is for ball number 2: 43 The winner is for ball number 3: 23 The winner is for ball number 4: 18 The winner is for ball number 5: 38 >Don’t forget to “chmod +x” it. Great for choosing winners randomly in a contest. Write the number down after each toss. I will let you mod the code to save the numbers. Note: it does not check for duplicates. Another way to do it. usage ./rndom choicesperball numberofballs ./rndom.sh 50 5 Choices per ball are 50 and the number of balls is 5 Ball number 1 is 35 Ball number 2 is 31 Ball number 3 is 6 Ball number 4 is 42 Ball number 5 is 3 $ cat rndom.sh #!/bin/bash clear echo "Choices per ball are $1 and the number of balls is $2" echo for (( c=1; c<=$2; c++ )) do echo "Ball number $c is $[($RANDOM % $1)]" done Note: this is a good way to give out prizes at a meeting. Just make sure everyone has their own number. One last variation: $ shuf -i 1-49 -n18 | xargs -n6 41 34 28 4 36 45 7 2 31 25 38 14 44 32 6 17 11 46 $ shuf -i 1-49 -n24 | xargs -n6 41 13 10 45 29 30 47 43 33 9 32 34 18 36 14 44 48 8 38 31 26 6 35 39 $ shuf -i 1-49 -n28 | xargs -n7 34 10 5 45 43 35 2 42 18 7 22 30 47 23 13 6 19 49 48 4 11 24 8 20 29 31 17 27 </p>
Warning Bug Issue With Bash,
Per ArsTechnica:
Security vulnerability in the GNU Bourne Again Shell (Bash), the command-line shell used in many Linux and Unix operating systems, could leave systems running those operating systems open to exploitation by specially crafted attacks. “This issue is especially dangerous as there are many possible ways Bash can be called by an application,” a Red Hat security advisory warned.
The bug, discovered by Stephane Schazelas, is related to how Bash processes environmental variables passed by the operating system or by a program calling a Bash-based script. If Bash has been configured as the default system shell, it can be used by network–based attackers against servers and other Unix and Linux devices via Web requests, secure shell, telnet sessions, or other programs that use Bash to execute scripts.
Because of its wide distribution, the vulnerability could be as wide-ranging as the Heartbleed bug, though it may not be nearly as dangerous. The vulnerability affects versions 1.14 through 4.3 of GNU Bash. Patches have been issued by many of the major Linux distribution vendors for affected versions, including: Red Hat Enterprise Linux (versions 4 through 7) and the Fedora distributionCentOS (versions 5 through 7)Ubuntu 10.04 LTS, 12.04 LTS, and 14.04 LTSDebianA test on Mac OS X 10.9.4 ("Mavericks") by Ars showed that it also has a vulnerable version of Bash. Apple has not yet patched Bash, though it just issued an update to "command line tools."
While Bash is often thought of just as a local shell, it is also frequently used by Apache servers to execute CGI scripts for dynamic content (through mod_cgi and mod_cgid). A crafted web request targeting a vulnerable CGI application could launch code on the server. Similar attacks are possible via OpenSSH, which could allow even restricted secure shell sessions to bypass controls and execute code on the server. And a malicious DHCP server set up on a network or running as part of an “evil” wireless access point could execute code on some Linux systems using the Dynamic Host Configuration Protocol client (dhclient) when they connect. There are other services that run on Linux and Unix systems, such as the CUPS printing system, that are similarly dependent on Bash that could be vulnerable. There is an easy test to determine if a Linux or Unix system is vulnerable. To check your system, from a command line, type: $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"If the system is vulnerable, the output will be: vulnerable this is a test
An unaffected (or patched) system will output: $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test" bash: warning: x: ignoring function definition attempt bash: error importing function definition for `x' this is a test
The fix is an update to a patched version of the Bash shell. To be safe, administrators should do a blanket update of their versions of Bash in any case.
-------------------------------------------------------------------------------------------------
My ubuntu 14.04 system before the update:
$ env x='() { :;}; echo vulnerable' bash -c "echo this is a test" vulnerable this is a test
After the update: $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test" bash: warning: x: ignoring function definition attempt bash: error importing function definition for `x' this is a test
Network Printer Install.
Setting a network printer is easy as setting up most any other printer.
You need to know about the printer location make and model. You will also need some administrative rights to install the printer. In this case, we will be using the Cups web based utility to accomplish adding the printer. First, if you do not already have access, you need access.
$ sudo adduser $USER lpadmin
Adding user `eddie' to group `lpadmin' ...
Adding user eddie to group lpadmin
Done.
Note: for more command line goodies, see http://www.cups.org/documentation.php/options.html
Whew, that is all the command line you need to do. Now you need to open your web browser to "localhost:631". Localhost is just a generic name so you do not have to use your real ipaddress. When you first go to cups, you will be asked some rudimentary questions about your setup.
Then you need to choose a printer.
On this network you have one print server that has two parallel ports and one usb port. Notice that cups recognized the equipment (make sure it is turned on!). You could have just as well chose a local printer if that was the one you wanted to use. You can always add more printers later. For now we are choosing pportusb3 or the third port on the printer server that has a usb interface.
The we can choose the printer manufacturer. Press continue. In our case, we have an HP printer. Pretty common nowadays. For the computer to be able to communicate and control the printer, you need what is known as a printer driver. Tradidionally you would have to go find the printer install CD/ DVD. Fortunately Cups already has quite a few printer drivers to choose from. So the printer driver install media will be pretty much a drink coaster.
Our printer is an OfficeJet 6110. Awesome, that is one of the available drivers! So press add printer and let the driver be installed. Then you will need to install the default options. Go with the existing default options till you have seen a print out. You can easily change these options later. Press set default option.
Your printer shoudl be pretty much setup now. You can go the admin pull down menu and print a test page to see if any default options need to change..
Once you have chosen to print a test page, you will get a message at the bottom of the screen about the page being printed.
You are now done with the printer setup. You can visit the other menus or just close the browser. Now the next time you need to print, the print option should show you your printer.
Command Line to Gui.
With Linux does not mean you have to do everything via the command line.
For example you might want to import a picture into Tuxpaint. That requires you know what command to use and know where the file to be converted is.
$ tuxpaint-import file2bconverted.ext
Now you could make the program semi gui with using the zenity command.
tpimport.sh
[code]
#================================
#
# Tuxpaint file import catcher
#
#=================================
# Assignments
# --------------------------------
szAnswer=$(zenity --file-selection --title="Select a file to convert to tuxpaint")
datafile=$szAnswer
#=================================
#
# Data input
#---------------------------------
tuxpaint-import $datafile
[/code]
Once you create the file, you will want to make it executable.
$ chmod +x tpimport.sh
From there you could run the program with:
$ ./tpimport.sh
or you would get sort of a gui with:
Then you would get the file selector.
You can select the file to convert from there without knowing a bunch of commands to get to where the file is. Now we can go one step farther and create an icon that can be easily double clicked to execute the shell file. To do that you want to create a launcher. Just right click where you want the launcher to reside such as at the desktop and then click on create launcher.
You will want to select a name for the launcher and even choose a graphic for the launcher but the most important is to choose the tpimport.sh as the file to execute.
Of course, I have already chose the command.
Then finally you have an icon to double click without having to deal with the command line. Tada!
For more information on Zenity: http://linux.die.net/man/1/zenity