So I’ve just migrated my mail server recently. I was initially using iRedMail but needed to move it to another server. The problem though is that the destination server already had MySQL and Nginx as a web server. I just wasn’t comfortable running a script that has a chance to break what I’ve currently setup. I also didn’t want to take the route of creating my own email server from cratch. I’ve already did it in the past and it was okay but it was a hassle to maintain. So like anyone else I’ve jumped to Google to search for any free open source email server. Lucky for me I was able to find Mailcow relatively quickly. It’s open source and uses popular open source software for the email server components (MTA, Database, WebServer, etc.). The great thing about it though is that its dockerized which would not interfere with what is currently installed in the destination server. Continue reading
Update: If you’re already using Python >=3.3 then there’s is already a package called venv which you can use to create you’re virtual environment with just:
python3 -m venv myennv
virtualenv is very useful in developing Python because you can create your project’s own environment without polluting the or messing with the global or your other projects Python environment.
First make sure that you have already installed virtualenv and pip for Python 3.
$ sudo apt-get install python3-pip $ sudo pip3 install virtualenv
This will be a tutorial for setting up your own LEMP stack on Debian 7 Wheezy. This might be also used for installing one on Ubuntu but is not guaranteed.
LEMP is almost the same with a LAMP stack but the Web server part is replaced with Nginx. LEMP is an acronym for a software bundle of Linux, Nginx(for E), MySQL and PHP. Sometimes any of this softwares gets replaced like MySQL can sometimes be replaced with MariaDB and PHP either Perl or Python. Continue reading
This will be a tutorial for setting up your own LAMP stack on Debian 7 Wheezy but this might also work for Ubuntu but is not guaranted.
What Is LAMP?
LAMP is an acronym for a software bundle that is Linux, Apache, MySQL & PHP. There are already available installer for this software stack like XAMPP which can be easily installed but if you want to setup your own LAMP stack using Debian aptitude then please read on. Continue reading
Okay, Ive done this sometimes where I typed in my password hastily and ended entering it incorrectly mutiple times which results to my IP being ban by fail2ban. To unban your IP you need to either wait for the ban time you set to expire or if you cant you will need to access your server using a different IP address.
Once you have gained access to your server type this in:
iptables -L -n
Search for the line where you IP is. It should be below the line of:
Chain fail2ban-ssh (1 references)
If its there then your IP is still banned from using SSH. To remove it type:
iptables -D fail2ban-SSH -s [your-ip] -j DROP
Change “[your-ip]” to your actual IP. Now check again the iptables and the entry for your IP is should now be gone and this means that you are now unban from fail2ban-ssh.
After you have created your first VPS, your VPS provider should give you the credentials for logging in through ssh. For Linux users you can just type into the terminal:
For Windows user you can download Putty an application that can be used for ssh. Now connect to your VPS through ssh. I assume you are now using the root user.
Make sure that your server is updated. Type in:
apt-get update apt-get upgrade
Change “root” Password
This part is optional, if you want to change the “root” password to something that you will be able to remember then use the below command otherwise move on to “Secure ssh”
Normally using sudo will request the user a password after executing it but sometimes we might need to run a command with sudo from a script(bash script) or from a program. To auto enter a password for a script that will execute a sudo command you will need to do it like this in your script:
echo [password] | sudo -S echo "Sudo with auto enter of password"
Just replace the “[password]” with your actual password. Notice that we have “-S” as the option we pass for the sudo command. This option enables sudo to read the password from stdin where we have echoed our password.
Just an opinion but if you find yourself needing to auto enter a password in sudo command then maybe you should consider running it as a root user instead.
If you have two network interface in your Ubuntu eth0 and usb0 and the default network interface is eth0 but you want to use usb0 for internet connection. To make this happen you must set usb0 as your default interface so that when you need to access something that isnt located in the eth0 interface local network, usb0 will be used. For example you have a phone and you want its data connection to be tethered to your Ubuntu desktop. Once connected to your desktop it registered as usb0. So now you have both eth0 and usb0 interface registered and you want usb0 to be used for internet connection but still want to be able to connect to a computer that resides in eth0 local network and eth0 network also have an internet connection. By default eth0 will always be used since it it will be more likely the default interface. Continue reading
When I first got on the Linux boat I only know that apt-get is a command to either install or remove a package from the system and only used the Synaptic Package Manager for searching packages. After a long time using Debian/Ubuntu I got to know some handy apt commands.
Here are the list of apt commands that I know right off the top of my head.
apt-get install [package name]
I think this is the first command that all people learned when they first tried Linux using Debian or Ubuntu. This command will install the package with the package name you entered
This command will update your systems record/cached packages list using the locations in your sources list.
apt-get remove [package name]
If you want to remove a specific package you can use this command.
apt-get purge [package name]
This command is the same as “remove” and will also remove its configuration files.
apt-cache search [package name]
You can use this command if you dont know the exact package name. This will search the package in your systems cached packages and return the results so running apt-get update is advisable before you use this.
This will update all packages that are installed in your system.
This will upgrade your system distribution to the latest one if its already available so this also perform the upgrade command
Check if Samba is installed
apt-cache policy samba
You should see something like this if it is installed:
Samba: Installed: 2:3.4.7~dfsg-1ubuntu3.7 Candidate: 2:3.4.7~dfsg-1ubuntu3.10
otherwise “Installed” on the top has a blank value. To install type in:
sudo apt-get install samba
After successfully installing Samba you can now connect to a shared folder on the network.
Suppose you want to connect to “192.168.0.114” shared folder named “Public” . You just need to type:
smbclient //192.168.0.114/Public -user [Your_User_Name]
“-user [Your_User_Name]” argument is optional. If no “-user” indicated you will be defaulted to the default user. After pressing enter with the above command, the terminal is going to ask for your password. After that the terminal should look like this:
You are now successfully log-in in the server computer and ready to write to or copy from it.
To write a file in the server using Samba client use the command:
puts [local name]
- [local name] is the filename of the file you want to transfer on the current directory before you connect in samba client. This can also be a filepath relative to the current directory or an absolute path.
- is optional. If no is specified the filename of [local name] will be used.
Suppose we have a file named “test.txt”. We can transfer it by:
smb: \>puts test.txt
If we want it to be named “test2.txt” on the server. Type in:
smb: \>puts test.txt test2.txt
Make sure you have write access to the folder or else youll get an error like this “NT_STATUS_ACCESS_DENIED opening remote file ”
You can copy files from the server with Samba client using the command:
get [local name]
and [local name] are the same as the the “put” command above.
To exit the Samba client just type “exit”.