GN Latest News

How to Update your Server.

How to Block a Suspicious IP Address.
How to Create a User Interface for Spamassassin
Backup and Restore Procedure.
How to Update your Server.
How to Update your EHCP force Version.
Post Reply
Rob Swan
Site Admin
Posts: 70
Joined: Tue Oct 31, 2017 3:03 pm
Location: UK
Contact:

How to Update your Server.

Post by Rob Swan »

For me one of most important steps you need to take to keep your server running without interruption when it is unattended is to turn off automatic updates.

I know most will say this is totally the wrong thing to do, but let me tell you a little story.

A while ago I went on a Holiday, my server was set for automatic updates.

I got a phone call from a friend to say that the server was down. I checked from my end and I could not get any response from my server remotely using any method.

A week later when I returned home, I checked my server to see what was going on.

To cut a long story short, due to chain reaction caused by a failed auto update the entire thing was beyond recovery (within a sensible time frame), so had to re-install the entire thing from scratch.

If automatic updates had been turned off this would not have happened, the only downside would be that I would have to update the system myself maybe once a week.

It your call, but I highly recommend you turn off automatic updates, so here is how it’s done.

Login to your server using your PC and PuTTY.

Enter this command.

sudo vi /etc/apt/apt.conf.d/20auto-upgrades

Image

When the file opens files press I for insert and change this line.

APT::Periodic::Unattended-Upgrade "1";

To

APT::Periodic::Unattended-Upgrade "0";

We just changed the 1 to a 0.

Image

Some other websites may tell you to change this line instead

APT::Periodic::Update-Package-Lists "1";

This would work but then you will not be informed of available updates when you login using Putty.

Then save the changes and exit the editor (Press Escape, then :w (enter) then :q (enter) )

Re boot your server as normal with this command.

sudo shutdown -r now

Automatic updates have now been turned off.

If you did turn of automatic updates then here is how to update your server by hand.

It is probably a good idea to reed through THIS FAQ before continuing

Log into you server using your PC and Putty.

Image

If your server says there are no updates to do, then nothing to do just log out (type exit and then press enter)

If there are updates to be done then enter this command.

sudo apt-get update (press enter) (as always you may need to re-enter your password)

Image

Be patient and wait for it to finish…. (Wait for the prompt YOUR-USERNAME@Web-Server:~$ )

Image

Next run this command to actually install the updates.

sudo apt-get upgrade (press enter)

Image

Enter Y continue when prompted to do so….

During the update process you may see this screen or similar.

Image

If you do see this screen, use the up and down arrow to highlight each package, then press the space bar to put a * in the brackets.

Make sure each package in the list is selected with a star in the brackets.

Next, press the TAB button on your keyboard to select the Ok option.

Image

Then press enter.

You may see a longer version of the same screen, with a scroll bar to the right.

Image

In this case you need to do the same thing and select everything in the list, but you must keep pressing the down arrow until the scroll bar is at the end.

Then press TAB to highlight the Ok option, and then enter.

In the future there may be other screens that pop up, if I see any new ones, I will add them to this topic.

Again be patient and wait for it to finish…. (Wait for the prompt YOUR-USERNAME@Web-Server:~$ )

Image

Now re-boot your server using this command…..

sudo shutdown -r now (press enter)

You may get this message from Putty (if so click OK, close Putty using the windows X symbol)

Image

Wait a few minutes to give your server chance to re-start.

Log back in using Putty (if you cannot log into your server, it probably has not yet fully re-started).

If the system is still showing updates available run this command.

sudo apt-get dist-upgrade

Follow the same procedure as above to install the additional updates and then reboot your server once again.

After running the second command, if they are still updates available follow the update procedure again.

We have done when the system tells us we have no updates available (usually only takes one go).

Image

This is something that you should do a least once a week to keep your system running smoothly. I tend to do this anytime the system tells me it needs doing.

Also once the system is actually live, I would suggest you take backups just in case the updates cause you any problems.

If you are done for today logout by typing exit (press enter)

Note: if your server refuses to update all the packages then visit THIS FAQ POST


Last bumped by Rob Swan on Sat Jan 20, 2018 3:57 pm.
Post Reply