Monthly Archive: May 2015

How to fix no public key available for the following key IDs in debian 10

How to fix no public key available for the following key IDs in debian

On new debian servers, upon attempting to apt-get update you may see the following error

root@myserver:~# apt-get update
Get:1 http://security.debian.org wheezy/updates Release.gpg [1571 B]
Get:2 http://security.debian.org wheezy/updates Release [102 kB]
Get:3 http://ftp.debian.org wheezy Release.gpg [2390 B]
....
Reading package lists... Done
W: There is no public key available for the following key IDs:
9D6D8F6BC857C906
W: There is no public key available for the following key IDs:
7638D0442B90D010

The easiest way i’ve found to solve this problem is to do the following.

apt-get install debian-keyring debian-archive-keyring

Try to update again

apt-get update

And voilia! No more errors

2

How To Install Linux, Nginx, MySQL & PHP (LEMP) on Debian 8

As always we start off with

apt-get update
apt-get upgrade

Install MySQL Server

apt-get install mysql-server

You will be prompted to input a password, put anything “secure”

Now let’s secure our database.

mysql_secure_installation

This will ask you a few questions

– Enter “secure” password set previously
– Change Password : n
– Remove Anonymous Users : Y
– Disallow root login remotely : Y
– Remove test database : Y
– Reload privilege tables : Y

 

Install and Configure PHP (+optional modules)

Install php and a few important modules with the following command

apt-get install php5-fpm php5-mysqlnd php5-mcrypt

Now in /etc/php5/fpm/php.ini change the following lines (you need to search for each one)

;cgi.fix_pathinfo=1
upload_max_filesize = 2M
post_max_size = 8M

to

cgi.fix_pathinfo=0
upload_max_filesize = 12M
post_max_size = 16M

Install and Configure NGINX

apt-get install nginx

Nginx is now installed and if you go to your IP address you should see the welcome page

To configure nginx to work with php, edit /etc/nginx/sites-availiable/default with the following changes. (lines with edits are highlighted)

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
}

Lets not forget to restart nginx

service nginx restart

 

Finishing off

Create a test page and try it out at http://my.ip.address/info.php

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

 

 

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