Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Use case:

When I install Ubuntu on another computer, I need to:

  • install all the packages that I use;
  • make some config changes;
  • svn checkout some projects;
  • git clone some projects;
  • setup .ssh/config;
  • download a custom Eclipse build;
  • download some additional Eclipse plugins;
  • make many other tweaks.

So, I want to run a script, like sudo install-everything-needed, that would execute these predefined actions.

Is there any package that provides the backbone for such system?

share|improve this question
    
To site admins: in Ubuntu 11.04 + Chromium 11 the bullet "I need to install all the packages that I use." doesn't have an upper margin. –  Denis Gorbachev May 22 '11 at 7:42

2 Answers 2

Kickstart Install python-pykickstart

im1

kickstart Configurator is a graphical tool for creating Kickstart files , which allow scripted fully automatic installations. You will need to use the alternate install and you can set anything Ubuntu asks during install (including formatting discs). Anything you leave blank will be asked during install.

Now for the caveat: kickstart is not perfect in Ubuntu because it is missing a lot of features. For instance you need to manually change the ks.cfg file to add what you want to install and you need to tell it all (so you need to add ubuntu desktop too...) in order to add other packages.

You will need a post-install text file that includes all your configuration settings for the remaining settings you need to do and add that to the configuration. But you can also use this to add in downloads that require wget or move a pre-defined ssh settings file to the system etc etc. As for this script... you are on your own there. No-one will have the same add-ons so it will be all manual work.

Best way to do this is by installing a virtual machine and tweak the config file until you are satisfied: that way you can edit the ks.cfg file and remaster the ISO without needing to burn CDs.

More information on the Ubuntu help page.

share|improve this answer
    
What about applying modifications to an already installed system? –  Denis Gorbachev May 22 '11 at 17:53
    
I do this as a 2-parter: I have the ks.cfg file to create the same setup over several machines and the script for post install options is executed after install. But then you can also execute only the script on an existing install (they are independent) –  Rinzwind May 22 '11 at 17:57

If you're familar with shell scripting, you could hack something yourself. I don't think there is a such package available from the repositories since the requirements vary in each case.

You might want to enable all repositories using:

sudo sed 's@# deb@deb@' -i /etc/apt/sources.list

Update your repo information and upgrade your system (including kernels) and install packages (without prompting / accepting changes: -y):

sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y install subversion git [more packages here]

As shown previously, you can use tools like sed for editing configuration files.

svn checkout using:

mkdir -p ~/dir/in/home
cd ~/dir/in/home
svn --no-auth-cache --username [svn-user] --password [password-here] co http://svn.example.com/repo targetdir

--no-auth-cache prevents keyring applications from pausing the automatic process. Another reason to disable it for automatic processes is due to a bug in KWallet with causes a segfault when opening a keyring ("wallet"). In the case of an anonymous checkout, you can omit the authentication parts.

mkdir -p ~/dir/in/home2
cd ~/dir/in/home2
git clone http://git.example.com/repo.git targetdir

SSH config (client):

mkdir ~/.ssh
cat > ~/.ssh/id_example_rsa <<PRIVATEKEY
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,.....

wtzol/3qd5LrCvUedVE....
78PlmRpeNbeGVaqvm8wN2gPdV3wiaC9/3RUCJo/6V9Rq+oNdXuR+vg==
-----END RSA PRIVATE KEY-----
PRIVATEKEY
cat > ~/.ssh/config <<'CFG'
Host example
    Hostname example.com
    Port 22
    User example-user
    IdentityFile ~/.ssh/id_example_rsa
CFG

Instead of putting the stuff in the script, you can put it on an USB stick as well and cp it:

cp /media/NAME/id_example_rsa ~/.ssh/

If you put it on a server:

wget http://example.com/config -O ~/.ssh/config

It should be obvious that it's not clever to put private keys on a public-faced server.

I've no experience with Eclipse, but your should be fine with wget.

share|improve this answer
    
Yes, I'll definitely have to write shell scripts. What I've asked for is a platform, facilitating common features like "check if modification is already done before applying it" and "define what modifications you need by creating a profile" –  Denis Gorbachev May 22 '11 at 17:53
    
For text files, you could use the patch program. Create an unified diff using diff -u. Common options are -B (ignore blank lines). For whole directories, -r (recursively compare directories), -N (inexistent files are treated as empty). Example: diff -uBrn /etc/nanorc /etc/nanorc.new > nanorc.patch (/etc/nanorc is the original one, /etc/nanorc.new contains new changes), fix it with sudo patch -p0 < nanorc.patch. -p0 causes the whole path being used, otherwise only the basename would be used. –  Lekensteyn May 22 '11 at 18:59
    
@Denis: From your question, I made up that you've a freshly installation of Ubuntu. Is this not the case? –  Lekensteyn May 22 '11 at 19:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.