Category: Linux

How to enable autocompletion in screen 2

How to enable autocompletion in screen

You may have noticed that when you are using screen, auto-completion (bash-completion) stops working.

This can be remedied by creating a file called .screenrc in your home directory and adding to it “defshell -bash”.  You can also paste the following into your console and restart your server

echo "defshell -bash" >> ~/.screenrc
How to fix untrusted certificates error in ubuntu/debian 1

How to fix untrusted certificates error in ubuntu/debian

If you are experiencing the following error

ERROR: The certificate of `raw.github.com' is not trusted.
ERROR: The certificate of `raw.github.com' hasn't got a known issuer.

Then you simply need to install ca-certificates.. you can do that with the following:

apt-get install ca-certificates
7

How to fix 550 recvq/fax000000005.tif: Operation not permitted

So you setup your elastix or HylaFAX Server and you can’t save or download any of the faxes in your client. Most likely its an issue where your permissions are not set on the downloaded files.

To check, go to the received fax directory on the server and check the permissions on your .tif files.

[root@pbx recvq]# ls -la /var/spool/hylafax/recvq/
total 64
drwxrwxrwx 2 uucp uucp 4096 Oct 14 12:22 .
drwxr-xr-x 17 uucp uucp 4096 May 3 14:53 ..
-rw------- 1 uucp uucp 12962 Oct 14 11:20 fax000000005.tif
-rw------- 1 uucp uucp 14832 Oct 14 11:31 fax000000007.tif
-rw------- 1 uucp uucp 1 Oct 14 11:30 seqf

As you can see in my case the files are only readable by uucp. so lets

chmod 666 fax*.tif

Now open your Halyfax client (I use YajHFC), refresh and ensure you can now view your faxes. Most likely now you can, so lets tweak our modem config and make sure future files save properly.

In your modem config file (located in /var/spool/hylafax/etc/config.YourModem [In my case it was config.ttyIAX1]) we want to change the following

RecvFileMode:           0666

Save and you’re done!

 

Other Notes:

If chmod 666 didn’t work try chmod 777
On your client ensure passive mode is disabled.

0

How to make iptables rules permanent

To setup persistant iptables rules, after we enter our iptables as usual, we export them to config file.

iptables-save > /etc/iptables.conf

Edit your global rc.local file [/etc/rc.local] with your favorite editor and before the ‘exit 0’ add:

iptables-restore < /etc/iptables.conf

Save and restart, your iptables rules are now permanent

mysqlnd vs libmysql 0

mysqlnd vs libmysql

TL:DR If you are using php 5.3.3 or newer then go mysqlnd, otherwise stay with the default libmysql.

Whats the difference? While I could post it here for you, a more updated source would be http://www.php.net/manual/en/mysqlinfo.library.choosing.php.

As you can see, currently mysqlnd does ‘pretty-much’ evrything libmysql does with a plethora of additional features. So why on earth is that even a valid question? Well.. its not… at least not currently… If we move a few years in the past, mysqlnd did not support compression or SSL, which was in many cases a deal breaker. As of PHP 5.3.3 all of these are supported and it just makes more sense to go with the native driver.

Personally I use mysqlnd because I love using fetch_all. So, how to install? Follow below:

apt-get remove php5-mysql
apt-get insall php5-mysqlnd

(Note. you may have to reinstall anything that depended on mysql, such as phpmyadmin)
0

How to get mssql to work on php (debian/ubuntu)

Assuming that you already have PHP installed, you enter into the console

 apt-get install php5-sybase

(sadly not as intuitive as apt-get install php5-mssql)

For most instances that may be enough to give you what you need. If by any chance that doesn’t work, or you need more ‘functionality’ you can try (untested by me)

apt-get install php-pear
pear install --nodeps MDB2_Driver_mssql
0

How to complile and install programs in linux

So you have a tar.gz file and you want to compile and install it.. To do that you need the gcc compiler (not always but its good to have anyways)…

apt-get update
sudo apt-get install build-essential

Cool, we have gcc and other essential build tools… cd into the directory with the tar.gz file and type the following

tar -xzvf myprogram.tar.gz
cd myprogram
./configure
make
make install

That should pretty much do it… of course, depending on what you are compiling the steps may be a bit different but more often than not there is a readme file in the extracted folder if you ever need to do extra configuration.

0

How to set fqdn in Linux

Edit /etc/hostname and change the text to your hostname:

blog

Edit /etc/hosts and edit like 2 to look like the following (under the one written 127.0.0.1 localhsot).

127.0.1.1 blog.devget.net blog

Where blog.devget.net is your FQDN and blog is your hostname

save and test your config by typing the following

hostname
This should output blog
hostname -f
This should output blog.devget.net

1

How to fix apt bash completion in Ubuntu/debian

In some situations, especially when using an openvz vps one may notice that auto-completion is not working as it should (especially on debian). Luckily the fix is simple, in your terminal type:

apt-get install bash-completion

 

If that doesn’t work you can try the following

sudo apt-get install --reinstall bash-completion

or

sudo apt-get install auto-complete-el

or at a last result edit the following

sudo nano /etc/bash.bashrc

and change

# enable bash completion in interactive shells
# if ! shopt -oq posix; then
# if [ -f /usr/share/bash-completion/bash_completion ]; then
# . /usr/share/bash-completion/bash_completion
# elif [ -f /etc/bash_completion ]; then
# . /etc/bash_completion
# fi
# fi

to

# enable bash completion in interactive shells
if ! shopt -oq posix; then
 if [ -f /usr/share/bash-completion/bash_completion ]; then
 . /usr/share/bash-completion/bash_completion
 elif [ -f /etc/bash_completion ]; then
 . /etc/bash_completion
 fi
fi
How to update django 0

How to update django

So i was recently faced with the dilemma of having to update django 1.6.1 to 1.6.2, after a bit of searching I came across a very.. very simple solution

pip install -U Django

Of course this is assuming you installed django… if not you most likely need to uninstall it by deleting the path where it lives.. eg

Python 2.7.5+ (default, Sep 19 2013, 13:48:49) 
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django
<module 'django' from '/usr/local/lib/python2.7/dist-packages/django/__init__.pyc'>
>>>

then

sudo rm -rf /usr/local/lib/python2.7/dist-packages/django/