Wednesday, June 22, 2016

package management - Install MySQL without apt-get


I want to install MySQL but my internet connection is very slow so I decided to download the database from the MySQL site.


I have read this question, but I don't have any friends using Ubuntu.



Well I thought this was an interesting problem. There are things like apt-offline that will help you if you have another Ubuntu machine connected to the internet (strongly suggest looking into it if you do) but there isn't much I can see to help people who are stuck needing packages of things.


And yes, I do think the packages are worth the effort in this case. MySQL is a hard thing to install well manually. There's a lot of configuration that dpkg handles for you with the ubuntu packages.


So I've written this one-line script. Give it a package to install (in this case mysql-server) and it'll use your local apt-get database in simulate mode to work out what packages it needs. You might be able to get away without an updated package list, but I strongly suggest you run sudo apt-get update before running this (you'll need some bandwidth for that).


apt-get install -qs mysql-server | grep "Inst " | awk 'BEGIN { FS="[ \(\)\[\]\/]+" } { print "http://packages.ubuntu.com/" $5 "/" $6 "/" $2 "/download" }'

This generates a list like this:


http://packages.ubuntu.com/maverick/all/libnet-daemon-perl/download
http://packages.ubuntu.com/maverick/all/libplrpc-perl/download
http://packages.ubuntu.com/maverick/i386/libdbi-perl/download
http://packages.ubuntu.com/maverick/i386/libdbd-mysql-perl/download
http://packages.ubuntu.com/maverick-updates/i386/mysql-client-core-5.1/download
http://packages.ubuntu.com/maverick-updates/i386/mysql-client-5.1/download
http://packages.ubuntu.com/maverick-updates/i386/mysql-server-core-5.1/download
http://packages.ubuntu.com/maverick-updates/i386/mysql-server-5.1/download
http://packages.ubuntu.com/maverick/all/libhtml-template-perl/download
http://packages.ubuntu.com/maverick-updates/all/mysql-server/download

Those links will take you to the packages.ubuntu.com website where you can download the packages (at their right versions). Unfortunately, this is a little bit manual and the website is pretty slow. People might be able to improve my script to provide direct download links to the packages.


Once you have the packages and you're back on your low-bandwidth system, either stick them in /var/cache/apt/archives/ and run the standard sudo apt-get install mysql-server or simply cd into the directory where the packages are and run `sudo dpkg -i *.deb"


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...