Add a New Disk in Linux- Partition and Format

Partition the new disk using fdisk command
Following command will list all detected hard disks:

# fdisk -l | grep '^Disk'

Output:

Disk /dev/sda: 251.0 GB, 251000193024 bytes
Disk /dev/sdb: 251.0 GB, 251000193024 bytes

A device name refers to the entire hard disk. For more information see Linux partition naming convention and IDE drive mappings. To partition the disk – /dev/sdb, enter:

Read more

Share

Perfect FTP Server for Debian or Ubuntu

This installation was performed on a Ubuntu 14.04 distribution system.

While there are a variety of FTP server tools available for Linux, one of the most popular and mature options is vsftpd. Begin by SSHing into your server as root and use the apt-get command to install vsftpd:

apt-get update
apt-get install vsftpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
[...]
The following NEW packages will be installed:
 vsftpd
0 upgraded, 1 newly installed, 0 to remove and 18 not upgraded.
Need to get 111 kB of archives.
After this operation, 361 kB of additional disk space will be used.
Get:1 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main vsftpd amd64 3.0.2-1ubuntu2.14.04.1 [111 kB]
Fetched 111 kB in 0s (231 kB/s)
Preconfiguring packages ...
Selecting previously unselected package vsftpd.
(Reading database ... 175600 files and directories currently installed.)
Preparing to unpack .../vsftpd_3.0.2-1ubuntu2.14.04.1_amd64.deb ...
Unpacking vsftpd (3.0.2-1ubuntu2.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up vsftpd (3.0.2-1ubuntu2.14.04.1) ...
vsftpd start/running, process 18690
Processing triggers for ureadahead (0.100.0-16) ...

Configuration
The next step is to change any configuration settings for vsftpd. Open the /etc/vsftpd.conf file in your preferred text editor:

Read more

Share

Install Proxmox VE on Debian 9 – Stretch

The installation of a supported Proxmox VE server should be done via Bare-metal_ISO_Installer. In some case it makes sense to install Proxmox VE on top of a running Debian Stretch 64-bit, especially if you want a custom partition layout. For this HowTO the following Debian Stretch ISO was used:

Install a standard Debian Stretch (amd64)

Install a standard Debian Stretch, for details see Debian, and select a fixed IP. It is recommended to only install the “standard” package selection and nothing else, as Proxmox VE brings its own packages for qemu, lxc.

Add an /etc/hosts entry for your IP address
Please make sure that your hostname is resolvable via /etc/hosts, i.e you need an entry in /etc/hosts which assigns an IPv4 address to that hostname.

Note: Make sure that no IPv6 address for your hostname is specified in `/etc/hosts`

For instance if your IP address is 192.168.15.77, and your hostname prox4m1, then your /etc/hosts file should look like:

Read more

Share

Upload Directory Tree To Remote FTP Server Recursively using NCFTP

Install ncftp client

Type the following apt-get command under Debian / Ubuntu Linux to install ncftp client, run:

$ sudo apt-get install ncftp

If you are RHEL / CentOS / Fedora Linux user, type the following yum command to install ncftp client (first turn on EPEL repo):

# yum install ncftp

Syntax and examples:

The syntax is as follows:

Read more

Share

Fixing phpmyadmin login on MySQL 5.7 and Debian 9

Once setting up the LAMP stack, you must be wondering to see that you no longer been able to login phpmyadmin using root credentials.

MySQL 5.7 changed the secure model: now MySQL root login requires a sudo (while the password still can be blank). I.e., phpMyAdmin will be not able to use root credentials.

The simplest (and safest) solution will be create a new user and grant required privileges.

1. Connect to mysql

sudo mysql --user=root mysql

2. Create a user for phpMyAdmin
Run the following commands (replacing some_pass by the desired password):

CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

If your phpMyAdmin is connecting to localhost, this should be enough.

Read more

Share

How to disable Network Manager on Linux

First Check if NetworkManager is running on Ubuntu / Debian

Usually you should be using NetworkManager by default (Ubuntu 14.04), just in case you want to be sure, use this command to verify:

dpkg --get-selections | grep network-manager

In case there is some output like:

network-manager install

it is installed, if there is nothing returned, you are probably using a different network managing daemon. It would be possible that network manager is installed but inactive. Lets check if its running the hard way:

ps aux | grep network-manager

If thats returning something different than itself, you can be sure using the NetworkManager in Ubuntu / Debian.

Disable Network Manager Completely

Here is how to disable Network Manager completely, so that Network Manager stops running on your Linux system.

To disable Network Manager on Debian 8 or later:

$ sudo systemctl stop NetworkManager.service
$ sudo systemctl disable NetworkManager.service

To disable Network Manager on Debian 7 or earlier:

$ sudo /etc/init.d/network-manager stop
$ sudo update-rc.d network-manager remove

To disable Network Manager on Ubuntu or Linux Mint:

Read more

Share

Zimbra Exporting all mail addresses

Exporting all addresses (mailboxes, aliases and distribution lists) is a vital tool if you have a backup MX and only want it to accept email for valid recipients. One reason for that is to stop spammers who simply use a dictionary of common names to generate recipient email addresses which would flood a backup MX with undeliverable email. Some anti-spam providers (e.g. Postini) have automatic provisioning processes for making this possible.

A naive process of extracting mailboxes looks like this:

/opt/zimbra/bin/zmaccts | grep 'active' | egrep -v '^\W+' | awk '{print $1}'

Unfortunately, this doesn’t give distribution lists and aliases, so a more sophisticated approach is necessary, for which there is no specific tool and requires using the ldap tool thus:

Read more

Share

Nginx upstream timed out

There are two main directives responsible for Nginx upstream timed out (110: Connection timed out) error:

proxy_read_timeout – Defines a timeout for reading a response from the proxied server. Default is 60 seconds.

location ~ ^/slow-proxy {
proxy_read_timeout 180; # <---
proxy_pass ...;
}

* you can use proxy_read_timeout inside http, server and location blocks.

Read more

Share

Install Redis Server and PHP-Redis on Debian or Ubuntu System

you can install the phpredis extension from the Ubuntu respositories.

First, if you don’t have it installed already, let’s install Redis:

sudo apt-get install redis-server

After we get Redis installed (and/or verified that it was installed), we can install the PHP module for Redis:

sudo apt-get install php5-redis

After the module is done installing, you will want to restart your webserver and/or process manager (php-fpm, spawncgi, et cetera). Once you’ve restarted, you can check phpinfo() for a new section labeled Redis.

On Ubuntu 14.x System, you may try:

Install Redis 2.8.9

sudo apt-add-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server

Remove Redis 2.8.9

sudo apt-get purge--auto-remove redis-server
 

 

 

Share

Set Up Nginx Load Balancing with SSL Termination

Nginx can be configured as a load balancer to distribute incoming traffic around several backend servers. SSL termination is the process that occurs on the load balancer which handles the SSL encryption/decryption so that traffic between the load balancer and backend servers is in HTTP. The backends must be secured by restricting access to the load balancer’s IP, which is explained later in this article.

Prerequisites
In this tutorial the commands must be run as the root user or as a user with sudo privileges. You can see how to set that up in the Users Tutorial.

Read more

Share