Install youtube-dl from the official repository in Ubuntu:
sudo apt-get install youtube-dl
To download a video execute the following:
youtube-dl <url>
E.g
youtube-dl http://www.youtube.com/watch?v=_z-hEyVQDRA
You can also specify other options
-b Best quality
-m Mobile version
-d High Definition
-g Don’t download, just show the url
-c Resume download of a video which was interrupted before
-w Don’t overwrite existing file
For complete list of switches execute man youtube-dl in terminal.
Information from http://www.absolutelytech.com/2010/06/26/howto-download-youtube-video-from-command-line-ubuntu/
Converting to mp3
Now install ffmpeg from the official repo.
sudo apt-get install ffmpeg
Next have a look to make sure the flv file has downloaded from youtube by typing
ls *flv
This will list all the flv files you have. What you should see is a flv file with the same name as the 'v' component of the youtube url you downloaded.
E.g if you downloaded http://www.youtube.com/watch?v=_z-hEyVQDRA then you should have a file called _z-hEyVQDRA.flv
Next you need to copy that file name and then put it in an ffmpg command like
ffmpeg -i <file name>.flv -acodec liblamemp3 <song name>.mp3
So for this example you would type
ffmpeg -i _z-hEyVQDRA.flv -acodec liblamemp3 MasterOfPuppets.mp3
Once this has successfully completed you will now have the mp3 file you were after.
Note For cleanup you may want to type rm _z-hEyVQDRA.flv to get rid of the flv file that you no longer need.
You can also download the mp3 directly from youtube without converting using ffmpeg
youtube-dl --extract-audio --audio-format mp3 <video URL>
Playlist
youtube-dl -cit --max-quality FORMAT --extract-audio --audio-format mp3 http://www.youtube.com/playlist?list=XXXXXXXXXXX
From the online help:
-x, --extract-audio convert video files to audio-only files (requires
ffmpeg or avconv and ffprobe or avprobe)
Bear in mind as well that youtube-dl defaults to using avconv so you should consider specifying either avconv or FFmpeg at the commandline. From the online help:
--prefer-avconv Prefer avconv over ffmpeg for running the
postprocessors (default)
--prefer-ffmpeg Prefer ffmpeg over avconv for running the
postprocessors
Further options for keeping the original video, adjusting the bitrate or quality of the audio and a few others can be seen by looking at youtube -h.
https://github.com/rg3/youtube-dl
Ubuntu Linux Tutorials, Tips & News
Wednesday, July 9, 2014
Sunday, October 20, 2013
Clean up your Linux computer
No matter how careful or fastidious you are, over time a lot of cruft builds up on your computer. Things like cached files, cookies, temporary files, packages, log files, and a whole lot more. All of this builds up and takes up a tens or hundreds of megabytes of disk space.
BleachBit for Linux
BleachBit has many useful features designed to help you easily clean your computer to free space and maintain privacy.
http://bleachbit.sourceforge.net/
Ubuntu Tweak
Ubuntu Tweak is an application to config Ubuntu easier for everyone. It provides many useful desktop and system options that the default desktop environment doesn't provide. With its help, you will enjoy with the experience of Ubuntu!
http://ubuntu-tweak.com/
BleachBit for Linux
BleachBit has many useful features designed to help you easily clean your computer to free space and maintain privacy.
http://bleachbit.sourceforge.net/
Ubuntu Tweak
Ubuntu Tweak is an application to config Ubuntu easier for everyone. It provides many useful desktop and system options that the default desktop environment doesn't provide. With its help, you will enjoy with the experience of Ubuntu!
http://ubuntu-tweak.com/
Monday, September 16, 2013
Server and Hosting Management
Ajenti is a server administration panel for Linux distributions and FreeBSD. It is similar to cPanel, ISPConfig and others like them, but kinda light in features. It is a Free Software application whose development is spear-headed by Eugene Pankov.Besides being a server administration panel, Ajenti may also be used by developers as a rapid-development platform to create Web frontends, and by hardware vendors to create Web interfaces.
http://ajenti.org
Virtualmin is a powerful and flexible web hosting control panel for Linux and UNIX systems based on the well-known Open Source web-based systems management GUI, Webmin. Manage your virtual domains, mailboxes, databases, applications, and the entire server, from one comprehensive and friendly interface. http://www.virtualmin.com/
http://ajenti.org
Virtualmin is a powerful and flexible web hosting control panel for Linux and UNIX systems based on the well-known Open Source web-based systems management GUI, Webmin. Manage your virtual domains, mailboxes, databases, applications, and the entire server, from one comprehensive and friendly interface. http://www.virtualmin.com/
Friday, March 8, 2013
Setting up a Wifi Hotspot on Ubuntu
The first thing I wanted to do after installing Ubuntu 12.04 is setup
a wifi hotspot. I have a Samsung Netbook N130. I use a usb-modem to
connect to the internet. I have a single data contract with Vodacom and I
want all my devices to use this data at the same time.
#lspci
Showed me that I have a :
Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express)
#lsmod
Shows that it uses the ath9k drivers (this information may help you to google for setup information specific to your machine.)
Also
#iwconfig
will give you the name of your wireless adapter name for example:
“wlan0 “or “wlan1” (note that the “0″ and “1″ are numbers not letters)
#sudo apt-get install dhcp3-server
#sudo apt-get install hostapd
#sudo gedit
This will bring up the editor with root privileges so that you can edit system files. (WARNING – editing system files can damage your system. Please do not edit system files unless you have made a backup of them first)
Open / Create the following files editing:
1. /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=my_hotspot
channel=1
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=1234567890
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
Please note: the “ssid” in this case “my_hotspot” is the name of the network that will show up on the device or laptop that will connect to the hotspot. The passphrase is a password – you can change this to any other 10 digit number. The device / laptop that wants to connect will have to enter this password.
Save the file.
2. /etc/default/isc-dhcp-server
Edit the line that says
INTERFACES=”"
To
INTERFACES=”wlan0″
Or change the “wlan0″ to “wlan1″ or whatever the wireless adapter name you have (see above section on gathering information.)
3. /etc/dhcp/dhcpd.conf
Make sure the follow lines are Commented out ( put a hash “#” sign at the beginning of the line ) the following lines:
# option definitions common to all supported networks…
#option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;
#default-lease-time 600;
#max-lease-time 7200;
Add the following lines to the file (copy and paste)
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.16;
option domain-name-servers 8.8.4.4, 208.67.222.222;
option routers 10.10.0.1;
}
(Note: the only other line in this whole config file that is uncommented is :
ddns-update-style none;)
4. /etc/default/hostapd
Add the following lines to the bottom of the file. Make sure similar lines are commented.
RUN_DAEMON=”yes”
DAEMON_CONF=”/etc/hostapd/hostapd.conf”
DAEMON_OPTS=”-dd”
(Note: This file makes sure hostapd program starts on bootup with your edited configuration files loaded)
5. /etc/network/interfaces
This is how my interfaces file looks:
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.255.0
(Note: Again you must change every “wlan0″ to the name of your adapter. This file may have more entries for other network adapters. Just make sure you edit the section of the wireless adapter you want to use. This file will automatically configure the wireless network adapter’s network address at bootup time.)
At this stage you can reboot. And hopefully any device / laptop should connect to your wifi hotspots network via the network manager applet. On these devices search for the network “my_hotspot” and type in the password.
At this stage however you cannot access the Internet. Which brings us to another important step:
Connect to the internet, and in a terminal type:
#ifconfig
On my netbook, one of the entries is for adapter “ppp0″ this is the network adapter for my usb modem and the connection to the internet. The following steps use “ppp0″ however you can swap it for your adapter name:
To share the internet connection we have to do a thing called “ip masquerading”.
First we have to allow ip forwarding:
#sudo gedit
edit /etc/sysctl.conf
Make sure the following line is uncommented and reads
net.ipv4.ip_forward=1
Save and close gedit. (reboot)
After reboot: Connect to the Internet and In a terminal type:
# sudo iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE
(Note the “ppp0″ adapter name in the above line. The 10.10.0.0 is the ip address of your network that you configured in steps 3 and 5 above. Your wifi hotspot will thus share the internet with up to 15 machines that are given the ip addresses 10.10.0.2 to 10.10.0.16)
All devices and laptops should now be able to browse the internet and download email. If this works we have to make this permanent:
#sudo gedit
edit /etc/rc.local
add this line just before “exit 0″
iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE
Reboot / Connect to the internet and Enjoy your wifi hotspot.
http://exain.wordpress.com/2011/03/31/making-a-wifi-hotspot-access-point-using-linux-wifi-lan-cardusb-adapter/
http://ubuntuforums.org/showthread.php?p=11890695#post11890695
http://ubuntuforums.org/showthread.php?p=11890408#post11890408
Source: https://thenewbieblog.wordpress.com/2012/05/01/wifi-hotspot-setup-on-ubuntu
Gathering information:
Opening a terminal and typing the following command :#lspci
Showed me that I have a :
Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express)
#lsmod
Shows that it uses the ath9k drivers (this information may help you to google for setup information specific to your machine.)
Also
#iwconfig
will give you the name of your wireless adapter name for example:
“wlan0 “or “wlan1” (note that the “0″ and “1″ are numbers not letters)
Installing Programs
I then installed 2 programs via apt. In a terminal enter the following command:#sudo apt-get install dhcp3-server
#sudo apt-get install hostapd
Editing Configuration Files
In a terminal:#sudo gedit
This will bring up the editor with root privileges so that you can edit system files. (WARNING – editing system files can damage your system. Please do not edit system files unless you have made a backup of them first)
Open / Create the following files editing:
1. /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=my_hotspot
channel=1
hw_mode=g
auth_algs=1
wpa=3
wpa_passphrase=1234567890
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
Please note: the “ssid” in this case “my_hotspot” is the name of the network that will show up on the device or laptop that will connect to the hotspot. The passphrase is a password – you can change this to any other 10 digit number. The device / laptop that wants to connect will have to enter this password.
Save the file.
2. /etc/default/isc-dhcp-server
Edit the line that says
INTERFACES=”"
To
INTERFACES=”wlan0″
Or change the “wlan0″ to “wlan1″ or whatever the wireless adapter name you have (see above section on gathering information.)
3. /etc/dhcp/dhcpd.conf
Make sure the follow lines are Commented out ( put a hash “#” sign at the beginning of the line ) the following lines:
# option definitions common to all supported networks…
#option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;
#default-lease-time 600;
#max-lease-time 7200;
Add the following lines to the file (copy and paste)
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.16;
option domain-name-servers 8.8.4.4, 208.67.222.222;
option routers 10.10.0.1;
}
(Note: the only other line in this whole config file that is uncommented is :
ddns-update-style none;)
4. /etc/default/hostapd
Add the following lines to the bottom of the file. Make sure similar lines are commented.
RUN_DAEMON=”yes”
DAEMON_CONF=”/etc/hostapd/hostapd.conf”
DAEMON_OPTS=”-dd”
(Note: This file makes sure hostapd program starts on bootup with your edited configuration files loaded)
5. /etc/network/interfaces
This is how my interfaces file looks:
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.255.0
(Note: Again you must change every “wlan0″ to the name of your adapter. This file may have more entries for other network adapters. Just make sure you edit the section of the wireless adapter you want to use. This file will automatically configure the wireless network adapter’s network address at bootup time.)
At this stage you can reboot. And hopefully any device / laptop should connect to your wifi hotspots network via the network manager applet. On these devices search for the network “my_hotspot” and type in the password.
At this stage however you cannot access the Internet. Which brings us to another important step:
Internet connection Sharing.
You will need to ask yourself the following information. How do I connect to the internet on my ubuntu computer / laptop? In my case I use a usb 3G modem. You need to know the name of the network adapter that you connect to the internet on. > This must be different from the network adapter you configured above. (ie wlan0)Connect to the internet, and in a terminal type:
#ifconfig
On my netbook, one of the entries is for adapter “ppp0″ this is the network adapter for my usb modem and the connection to the internet. The following steps use “ppp0″ however you can swap it for your adapter name:
To share the internet connection we have to do a thing called “ip masquerading”.
First we have to allow ip forwarding:
#sudo gedit
edit /etc/sysctl.conf
Make sure the following line is uncommented and reads
net.ipv4.ip_forward=1
Save and close gedit. (reboot)
After reboot: Connect to the Internet and In a terminal type:
# sudo iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE
(Note the “ppp0″ adapter name in the above line. The 10.10.0.0 is the ip address of your network that you configured in steps 3 and 5 above. Your wifi hotspot will thus share the internet with up to 15 machines that are given the ip addresses 10.10.0.2 to 10.10.0.16)
All devices and laptops should now be able to browse the internet and download email. If this works we have to make this permanent:
#sudo gedit
edit /etc/rc.local
add this line just before “exit 0″
iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE
Reboot / Connect to the internet and Enjoy your wifi hotspot.
Acknowledgements
When configuring and setting up mine I used and adapted the following Howto’s and forums:http://exain.wordpress.com/2011/03/31/making-a-wifi-hotspot-access-point-using-linux-wifi-lan-cardusb-adapter/
http://ubuntuforums.org/showthread.php?p=11890695#post11890695
http://ubuntuforums.org/showthread.php?p=11890408#post11890408
Source: https://thenewbieblog.wordpress.com/2012/05/01/wifi-hotspot-setup-on-ubuntu
Wednesday, December 12, 2012
Recovering grub after installing windows 7 on Ubuntu
To recover grub:
http://askubuntu.com/questions/83771/recovering-grub-after-installing-windows-7
- open the live version
-
open the terminal and run
sudo fdisk -l
to see where Linux is installed -
run
sudo mount /dev/sdaX /mnt
where x is the number you have found Linux word in -
run
sudo grub-install --root-directory=/mnt /dev/sda
to install grub -
run
sudo update-grub
to update grub and if this command didn't work run it after rebooting - reboot
http://askubuntu.com/questions/83771/recovering-grub-after-installing-windows-7
Saturday, December 8, 2012
How to add https to localhost
Use a Self-Signed SSL Certificate with Apache
These instructions will help you generate a generic self-signed certificate, which may be used to provide SSL service for all name-based hosts on your VPS. Please note that self-signed certificates will generate warnings in a visitor's browser; proceed to "Installing a Commercial SSL Certificate" if you need to set up SSL on a domain using a certificate signed by a commercial SSL provider.
These instructions will help you generate a generic self-signed certificate, which may be used to provide SSL service for all name-based hosts on your VPS. Please note that self-signed certificates will generate warnings in a visitor's browser; proceed to "Installing a Commercial SSL Certificate" if you need to set up SSL on a domain using a certificate signed by a commercial SSL provider.
Generate a Self-Signed Certificate
At the shell prompt, issue the following commands to enable SSL for Apache and generate a certificate:
At the shell prompt, issue the following commands to enable SSL for Apache and generate a certificate:
a2enmod ssl
mkdir /etc/apache2/ssl
openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.key
You will be asked for several configuration values. Enter values
appropriate for your organization and server, as shown here. This
example will create a certificate valid for 365 days; you may wish to
increase this value. We've specified the FQDN (fully qualified domain
name) of the VPS for the "Common Name" entry, as this certificate will
be used for generic SSL service.
Generating a 1024 bit RSA private key
...................................++++++
..............................++++++
writing new private key to '/etc/apache2/ssl/apache.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New Jersey
Locality Name (eg, city) []:Absecon
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SoftwareDev, LLC
Organizational Unit Name (eg, section) []:Web Services
Common Name (eg, YOUR name) []:archimedes.mydomain.com
Email Address []:support@mydomain.com
Configure Apache to use the Self-Signed Certificate
Since SSL name-based virtual hosts are still not supported in /etc/apache2/ports.conf, we'll need to add an entry for a specific IP address on your VPS as follows. You may use a single IP to provide self-signed SSL service for multiple vhosts, and the same IP may also be used for multiple non-SSL vhosts (HTTPS uses port 443, while HTTP uses port 80).
Replace "12.34.56.78" with your Linode's IP address. Next, edit the
virtual host configuration files for sites which you would like to
enable SSL on. For each virtual host, you must add the following
stanza (change the values as appropriate for each site). Note that
this example essentially reproduces the configuration for a non-SSL site,
with the addition of three lines for SSL.
Restart Apache:
Since SSL name-based virtual hosts are still not supported in /etc/apache2/ports.conf, we'll need to add an entry for a specific IP address on your VPS as follows. You may use a single IP to provide self-signed SSL service for multiple vhosts, and the same IP may also be used for multiple non-SSL vhosts (HTTPS uses port 443, while HTTP uses port 80).
File excerpt:/etc/apache2/ports.conf
NameVirtualHost 12.34.56.78:443
File excerpt:Apache virtual hosting file
<VirtualHost 12.34.56.78:443>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
ServerAdmin info@mydomain.com
ServerName www.mydomain.com
DocumentRoot /var/www/mydomain.com/public_html/
ErrorLog /var/www/mydomain.com/logs/error.log
CustomLog /var/www/mydomain.com/logs/access.log combined
</VirtualHost>
Restart Apache:
service apache2 restart
You should now be able to visit your site with SSL enabled (after
accepting your browser's warnings about the certificate).http://library.linode.com/web-servers/apache/ssl-guides
https://www.digitalocean.com/community/articles/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-12-04
http://askubuntu.com/questions/49196/how-do-i-create-a-self-signed-ssl-certificate
http://ubuntuforums.org/showthread.php?t=953607
Virtual hosts overlap on 443, first has precedence
sudo gedit /etc/apache2/ports.conf
Change it to
<IfModule mod_ssl.c>
NameVirtualHost *:443
Listen 443
</IfModule>
http://blog.breidert.net/virtual-hosts-overlap-443-first-has-precendence/
Sunday, November 11, 2012
apt-get update fails to fetch files,"Temporary failure resolving …" error
overview
There are two parts to your question:
- fixing temporary resolve messages
- fixing the package management issues
Temporary resolve
It is likely that this issue is either:
- temporary due to your Internet Service Provider not correctly forwarding internet naming (DNS) to either its or external DNS servers, or
- due to a change in your network has similarly blocked this naming - for example, new router/modem, reconfiguring a switch with a new configuration.
Lets look at the possible DNS resolving issues.
First, temporarily add a known DNS server to your system.
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Then run
sudo apt-get update
.
If this fixes your temporary resolving messages then either wait for 24 hours to see if your ISP fixes the issue for you (or just contact your ISP) - or you can permanently add a DNS server to your system:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
8.8.8.8
is Google's own DNS server.echo "nameserver 208.67.222.222" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
package-management issues
In addition to the temporary resolve issues - you have a few package management issues that need to be corrected - I'm assuming you have tried recently to upgrade from one Ubuntu version to the next recommended version - in your case from Natty (11.04) to Oneiric (11.10)
Open a terminal and type
sudo nano /etc/apt/sources.list
Look for lines that have your a different distribution name in the list than you were expecting - in your case - you have upgraded to
oneiric
but you have another release name natty
For example, look for lines that look like
deb http:/archive.canonical.com/ natty backports
Add a
#
to the beginning of the line to comment it out - for example#deb http:/archive.canonical.com/ natty backports
Save and re-run:
sudo apt-get update && sudo apt-get upgrade
You should not have any more release naming errors.
At the time of writing this, possible common release names include
lucid
, maverick
, natty
,oneiric
, precise
and quantal
Subscribe to:
Posts (Atom)