Reply
Highlighted
New Member
Posts: 10
Registered: ‎05-20-2013
Kudos: 16

Upgrading or Building Your Own UniFi Controller 3.1.1 in Layer 3 Amazon AWS

[ Edited ]

UPGRADING UniFi Controller to 3.1.1 in Layer 3

 

The UniFI Controller Instance by Ubiquiti is currently based on v2.3.9. In order to upgrade to v3.1.1 in Amazon EC2, CLI must be used.

You can follow the RAW Steps given by Ubiquiti.

But for some of you who's not familiar with CLI, you might find the instruction there to be quite intimidating.

I'll simplify the instruction there in below steps.

So without further due:

1. I assume that we've the original UniFi Controller v2.3.9 instance created from Ubiquiti's Public AMI in the East Coast. If it's not, don't worry. You can actually built your own from the scratch by using any plain Ubuntu OS you prefer.

 

2. Backup your Controller Configuration file by logging in to the controller (If you've your AP's managed by this controller already). If you're starting from scratch from the v2.3.9 image, ignore this.

 

3. Open the built-in Terminal if you're using OS X, or download SSH Client programs such as PUTTY for Windows user. PUTTY is a recommended SSH Client used by many.

 

4. Make sure the Permission of your Amazon Key Pair is correct. Only you should be allowed to read and write to the key pair, otherwise, our Amazon EC2 instance will reject the Key Pair.

To correct the permission of your Amazon Key Pair, use this string:

 

chmod 600 <location-of-your-amazon-key-pair>

 

5. After configuring our key pair, SSH to your instance by using this string

 

ssh -i <location-of-your-amazon-key-pair> root@<public-DNS-or-elastic-IP-of-your-instance>

 

SSH is a way for us human to communicate to our Amazon EC2 Instance. You need to open port for SSH in your instance's Security Group preferences. (port22 of TCP)

This is normally opened if you're following Ubiquiti's Guide on setting up your UniFi Controller in Layer 3

 

6. You should see something like this:

The authenticity of host '<public-DNS-or-elastic-IP-of-your-instance>' can't be established.

RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.

Are you sure you want to continue connecting (yes/no)?

 

enter

yes

 

7. This lines will appear:

Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-35-virtual x86_64)

 

 * Documentation:  https://help.ubuntu.com/

 

  System information as of Mon May 20 23:21:54 UTC 2013

 

  System load:  0.67              Processes:           63

  Usage of /:   54.9% of 7.87GB   Users logged in:     0

  Memory usage: 32%               IP address for eth0: 10.96.206.65

  Swap usage:   0%

 

  Graph this data and manage this system at https://landscape.canonical.com/

 

0 packages can be updated.

0 updates are security updates.

 

Get cloud support with Ubuntu Advantage Cloud Guest

  http://www.ubuntu.com/business/services/cloud

Last login: Thu Jan  3 19:16:44 2013 from 66-78-124-216.access.ripnet.com

_____________________________________________________________________

WARNING! Your environment specifies an invalid locale.

 This can affect your user experience significantly, including the

 ability to manage packages. You may install the locales by running:

 

   sudo apt-get install language-pack-UTF-8

     or

   sudo locale-gen UTF-8

 

To see all available language packs, run:

   apt-cache search "^language-pack-[a-z][a-z]$"

To disable this message for all users, run:

   sudo touch /var/lib/cloud/instance/locale-check.skip

_____________________________________________________________________

 

7. If that lines appear, you've successfully SSH-ed your Amazon EC2 Instance. Our next step is to add mongoDB to the apt source list. We do that by entering this string:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

 

which will result in

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.nUWU4WcH2H --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv 7F0CEB10

gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com

gpg: key 7F0CEB10: "Richard Kreuter <richard@10gen.com>" not changed

gpg: Total number processed: 1

gpg:              unchanged: 1

 

8. Now, enter this:

echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list

That command will add the newest mongoDB source to the source list which is needed by UniFi Controller.

 

9. After adding mongoDB to the source list, it's time to install them. We do that by entering

sudo apt-get update

 

and then

sudo apt-get install mongodb-10gen

 

which will result in:

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following packages will be upgraded:

  mongodb-10gen

1 upgraded, 0 newly installed, 0 to remove and 87 not upgraded.

Need to get 87.3 MB of archives.

After this operation, 96.3 MB of additional disk space will be used.

Get:1 http://downloads-distro.mongodb.org/repo/ubuntu-upstart/ dist/10gen mongodb-10gen amd64 2.4.3 [87.3 MB]

Fetched 87.3 MB in 4s (17.6 MB/s)        

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LC_CTYPE = "UTF-8",

LANG = "en_US.UTF-8"

    are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

locale: Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_ALL to default locale: No such file or directory

(Reading database ... 26428 files and directories currently installed.)

Preparing to replace mongodb-10gen 2.2.3 (using .../mongodb-10gen_2.4.3_amd64.deb) ...

arg: upgrade

Unpacking replacement mongodb-10gen ...

Processing triggers for man-db ...

locale: Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_ALL to default locale: No such file or directory

Processing triggers for ureadahead ...

Setting up mongodb-10gen (2.4.3) ...

mongodb start/running, process 1853

 

10. mongoDB has been installed, now it's time to install the new UniFi Controller. To do that, we shall add UniFi source to the source list. The same method as before.

echo 'deb http://www.ubnt.com/downloads/unifi/distros/deb/precise precise ubiquiti' | sudo tee /etc/apt/sources.list.d/unifi.list

 

Notice that I use the 'precise' distro in above command as the standard UniFi AMI is using Ubuntu Precise as it's OS.

You can change the string in between the aposthrope depending on your Ubuntu OS Installed

Spoiler
## Ubuntu Quantal (12.10):
deb http://www.ubnt.com/downloads/unifi/distros/deb/quantal quantal ubiquiti
## Ubuntu Precise (12.04):
deb http://www.ubnt.com/downloads/unifi/distros/deb/precise precise ubiquiti
## Ubuntu Oneiric (11.10):
deb http://www.ubnt.com/downloads/unifi/distros/deb/oneiric oneiric ubiquiti
## Ubuntu Natty (11.04):
deb http://www.ubnt.com/downloads/unifi/distros/deb/natty natty ubiquiti
## Ubuntu Maverick (10.10):
deb http://www.ubnt.com/downloads/unifi/distros/deb/maverick maverick ubiquiti
## Ubuntu Lucid (10.4):
deb http://www.ubnt.com/downloads/unifi/distros/deb/lucid lucid ubiquiti
## Ubuntu Karmic (9.10):
deb http://www.ubnt.com/downloads/unifi/distros/deb/karmic karmic ubiquiti
## Debian Lenny (5.0):
deb http://www.ubnt.com/downloads/unifi/distros/deb/lenny lenny ubiquiti
## Debian Squeeze (6.0):
deb http://www.ubnt.com/downloads/unifi/distros/deb/squeeze squeeze ubiquiti

11. Install the UniFi Controller 3.1.1:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50

 

then:

sudo apt-get update

 

after that:

sudo apt-get install unifi-beta

 

12. If there's a prompt, just enter

y

 

if there's no prompt then you're good to go.

The resulting dialog will be like this:

root@domU-12-31-39-16-CD-B3:~# apt-get install unifi-beta

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following packages will be REMOVED:

  unifi

The following NEW packages will be installed:

  unifi-beta

0 upgraded, 1 newly installed, 1 to remove and 88 not upgraded.

Need to get 29.1 MB of archives.

After this operation, 5722 kB of additional disk space will be used.

Do you want to continue [Y/n]?y

Get:1 http://www.ubnt.com/downloads/unifi/distros/deb/precise/ precise/ubiquiti unifi-beta all 3.1.1-2073 [29.1 MB]

Fetched 29.1 MB in 1s (19.3 MB/s)     

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LC_CTYPE = "UTF-8",

LANG = "en_US.UTF-8"

    are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

locale: Cannot set LC_CTYPE to default locale: No such file or directory

locale: Cannot set LC_ALL to default locale: No such file or directory

(Reading database ... 26437 files and directories currently installed.)

Removing unifi ...

 * Stopping Ubiquiti UniFi Controller unifi                              [ OK ] 

 Removing any system startup links for /etc/init.d/unifi ...

   /etc/rc0.d/K08unifi

   /etc/rc1.d/K08unifi

   /etc/rc2.d/S92unifi

   /etc/rc3.d/S92unifi

   /etc/rc4.d/S92unifi

   /etc/rc5.d/S92unifi

   /etc/rc6.d/K08unifi

Processing triggers for ureadahead ...

Selecting previously unselected package unifi-beta.

(Reading database ... 26357 files and directories currently installed.)

Unpacking unifi-beta (from .../unifi-beta_3.1.1-2073_all.deb) ...

Processing triggers for ureadahead ...

Setting up unifi-beta (3.1.1-2073) ...

 Adding system startup for /etc/init.d/unifi ...

   /etc/rc0.d/K08unifi -> ../init.d/unifi

   /etc/rc1.d/K08unifi -> ../init.d/unifi

   /etc/rc6.d/K08unifi -> ../init.d/unifi

   /etc/rc2.d/S92unifi -> ../init.d/unifi

   /etc/rc3.d/S92unifi -> ../init.d/unifi

   /etc/rc4.d/S92unifi -> ../init.d/unifi

   /etc/rc5.d/S92unifi -> ../init.d/unifi

 * Starting Ubiquiti UniFi Controller unifi                              [ OK ]

 

13. If it says OK, then it's done. You're instance are running UniFi Controller 3.1.1.

 But for those of you who're building your Instance from scratch, you might or might not get 

*Setting Java Home....fail

 

Navigate to Java Home Directory Fail Issue on Ubuntu - RESOLVED for further resolution

 

14. Just to wrap things out, enter:

reboot

 

15. That command will reboot our Amazon EC2 Instance. Wait for around one minute and you can test your newly upgraded controller from the browser by navigating to 'https://<public-DNS-or-elastic-IP-of-your-instance>:8443/'

 

16. Check the version by going to the admin tab.

 

17. You might also want to check

Adopting your Existing APs to set-inform to L3 Controller Address (No Factory Reset - SSH)

UniFi Controller on Different Regions - Layer 3 Amazon AWS

Java Home Directory Fail Issue on Ubuntu - RESOLVED

 

If you're to lazy to do all the strings, you might want to search UniFi 3.1.1 in the Public AMIs list and run your instance from that AMI. It contains a clean install of UniFi 3.1.1 on Ubuntu Precise 12.04. It's currently available in both the East Coast and Sydney.

N. Virginia = ami-fb264e92 (no longer maintained)

Sydney = ami-3126b60b

 

 

Regards,

JAP

Emerging Member
Posts: 53
Registered: ‎03-11-2013
Solutions: 1

Re: Upgrading UniFi Controller to 3.1.1 in Layer 3 Amazon AWS

awesome   this is just what i needed?

 

what if i wanted to go to the last public non beta release?

Emerging Member
Posts: 53
Registered: ‎03-11-2013
Solutions: 1

Re: Upgrading UniFi Controller to 3.1.1 in Layer 3 Amazon AWS

[ Edited ]

so i followed your instructions, and now my server is down. i can still ssh into it, but cant access the login page

 

i tried running install again and get the following

 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
unifi-beta is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 101 not upgraded.

 

New Member
Posts: 10
Registered: ‎05-20-2013
Kudos: 16

Re: Upgrading UniFi Controller to 3.1.1 in Layer 3 Amazon AWS

[ Edited ]

Ebecker,

 

How do you know your server is down?

There're some posibilities:

 

1. Make sure the instance is running and there're 2 system check there.


2. Make sure you have the ports opened

Do NOT forget to create a new Security Group, UniFi, with

TCP 8080

TCP 8443

TCP 8880

TCP 8843

TCP 22

UDP 3478

ICMP ANY [ICMP is optional, it's the port which respond to network diagnostic such as ping, which is quite useful]

 

3. Don't forget to use https:// and use port 8443. The url in your browser should be 'https://<public-DNS-or-elastic-IP-of-your-instance>:8443/'

 

 


@ebecker wrote:

so i followed your instructions, and now my server is down. i can still ssh into it, but cant access the login page

 

i tried running install again and get the following

 

Reading package lists... Done
Building dependency tree       
Reading state information... Done
unifi-beta is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 101 not upgraded.

 


That string actually indicates that Unifi 3.1.1 have been installed.

 

4. If all seems dark, you might want to remove the software first then try reinstalling.

SSH to your instance and write

sudo apt-get update

sudo apt-get remove unifi-beta

That command will uninstall your controller. Now the first thing you should do after removing something is reboot.

reboot

After the reboot, re-SSH to your instance, install UniFi controller again

sudo apt-get update

 

sudo apt-get install unifi-beta

When asked, insert

y

 

5. If it's also not working for you, you might want to search UniFi 3.1.1 in the Public AMIs list and run your instance from that AMI. It contains a clean install of UniFi 3.1.1 on Ubuntu Precise 12.04. It's currently available in both the East Coast and Sydney.

N. Virginia = ami-fb264e92

Sydney = ami-3126b60b

 

PS: Regarding your question.

sudo apt-get install unifi will give you UniFI 2.3.9

sudo apt-get install unifi-beta will give you UniFi 3.1.1

New Member
Posts: 30
Registered: ‎10-06-2013

Re: Upgrading or Building Your Own UniFi Controller 3.1.1 in Layer 3 Amazon AWS

Re upgrading the unifi ver running on aws. The first step if from within the command line on a MAC. The line is chmod 600 < location-of-the-amazon-key-pair>

 

I have terminated the instance and the key pairs associated with the instance. I have re launched the instance and created a new key pair. When I copy / paste the address of the downloaded key file into the command line it comes up with unknown directory. Am I to use the internal address of the downloaded keypair of the external address from within AWS.

 

Many thanks.

 

(novice  to linux to willing to persevere) 

New Member
Posts: 10
Registered: ‎05-20-2013
Kudos: 16

Re: Upgrading or Building Your Own UniFi Controller 3.1.1 in Layer 3 Amazon AWS

[ Edited ]
It basically mean the address of your new key pair in your Mac right now, which is usually IN the Downloads folder if your download is set to that location.

Copy and paste does not always work with Terminal if the directory location contains spacebar.
Try drag and drop instead.

Write 'chmod600 ' first, then drag the key pair from your Finder window to your Terminal window.
It will automatically populate the location for you.
Press Enter.

If you want to know why copy and paste might not work, spacebar on command line language refers to a new string so when you enter a directory which contain spacebar to the command line, it sees spacebar as separator between string.
For example, when you enter 'Download Folder', it will recognize download as a string and folder as another string.
In order to make them as one string, it should be written as 'Download\ Folder' instead.
The path info in the Finder shows the GUI way of showing text.
New Member
Posts: 17
Registered: ‎06-17-2014
Kudos: 6

Re: Upgrading or Building Your Own UniFi Controller 3.1.1 in Layer 3 Amazon AWS

Thanks for the instructions!  Since the thread is about a year old, I am wondering whether these instructions for v 3.1.1 still accurate for installing v 3.2.1?  Are there any updates needed for current locations of mongoDB, source file address, or current version of unifi?  

New Member
Posts: 17
Registered: ‎06-17-2014
Kudos: 6

Re: Upgrading or Building Your Own UniFi Controller 3.1.1 in Layer 3 Amazon AWS

And, I was wondering if the instance gets messed up being updated (as there is always a potential), can I just start a new instance with a newer version and upload the backup file to it?...Seems like it would work, in theory, as long as the new instance of the controller can be configured with the same public address to which the AP's inform.  

New Member
Posts: 1
Registered: ‎08-12-2014

Re: Upgrading or Building Your Own UniFi Controller 3.1.1 in Layer 3 Amazon AWS

Great Post Been looking all day for something like this. I was trying to reinvent the wheel.

Reply