Posts

Fix postgres upgrade error when upgrade Gitlab-CE from 8.x to 9.0

Image
Right after Gitlab 9.0 was released, I upgraded our gitlab 8.x server and got stucked at PostGres upgrade with the following error:

...
Creating temporary data directory:Error creating new directory: /var/opt/gitlab/postgresql/data.9.6.1
...

I'd tried many things including changing the folder ownership and using a different tmp folder for postgres upgrade but it's still the same. Luckily, by searching through the Gitlab community edition issues site, I found out someone had a similar problem. I tried what they suggested and it worked. Here are the steps I had done to fix the upgrade:

1. Change the gitlab-psql users shell to /bin/bash (as root):

chsh -s /bin/bash gitlab-psql

2. Run dpkg-reconfigure dash and select NO will link /bin/sh to /bin/bash

3. Run the Gitlab upgrade again and everything was fine:

gitlab-ctl upgrade


Reference:https://gitlab.com/gitlab-org/gitlab-ce/issues/29907

WPA2 Enterprise with FreeRADIUS and AD integration on Ubuntu16.04

Image
So you don't want to use the RADIUS feature of your MS Windows server, do you? Here you go, FreeRADIUS, an open-sourced project that will please you.






Assuming:
172.100.99.100: FreeRADIUS IP addressmydomain.com: domain namemydc.mydomain.com: domain controllerMYNTDOMAIN: nt domain name
1. Install samba, winbind, krb5-user:

sudo apt install samba winbind krb5-user

2. Config samba by editing:

a. /etc/samba/smb.conf:

...
[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = MYNTDOMAIN

# need to add these
security = ads
password server = mydc.mydomain.com
realm = MYDOMAIN.COM
winbind use default domain = true
...

b. /etc/krb5.conf:

[libdefaults]
        default_realm = MYDOMAIN.COM

...

[realms]
        MYDOMAIN.COM = {
                kdc = mydc.mydomain.com
                admin_server = mydc.mydomain.com
                default_domain = mydomain.com
        }

...
[domain_realm]
        .mydomain.com = MYDOMAIN.COM
        mydomain.com = …

Fix freeradius-config installation error on Ubuntu 16.04 and FreeRadius3.0.X

Image
This morning, I just tried to install FreeRadius 3.0.X on my Ubuntu 16.04 server. And it said that I have to install freeradius-config in order to finish the installation. But, I got these error messages:

...
dpkg: error processing archive /var/cache/apt/archives/freeradius-config_3.0.12-ppa1~xenial_amd64.deb (--unpack):
 trying to overwrite '/etc/freeradius/hints', which is also in package freeradius 3.0.12-ppa1~xenial
Errors were encountered while processing:
 /var/cache/apt/archives/freeradius-config_3.0.12-ppa1~xenial_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
...

So what I did to fix that is to run the following command to force orverwrite the freeradius-config page:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/freeradius-config_3.0.12-ppa1~xenial_amd64.deb

Then the rest was fine.


Shakespeare in love with Vyatta

Image
This is a memo of my presentation last Saturday at the University of Information Technology about Vyatta. I'm just trying show how easy it is to get started with Vyatta and what job I'm doing right now.

Everything is around these commands:

show
config
set
delete
commit
save

It was fun.


References:

https://github.com/vyos
https://wiki.vyos.net/wiki/User_Guide#Firewall
http://networktutorials101.blogspot.com/2015/05/configure-vyosvyatta-firewall.html
https://github.com/bertvv/cheat-sheets/blob/master/src/VyOS.md

Search in all text files in Linux

Just use this command line:

grep -rnw '/path/to/somewhere/'-e "pattern"