Software – Internetblog.org.uk https://www.internetblog.org.uk Web hosting, Domain names, Dedicated servers Fri, 29 Jan 2016 11:05:52 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.5 https://www.internetblog.org.uk/files/2016/01/cropped-favico-32x32.png Software – Internetblog.org.uk https://www.internetblog.org.uk 32 32 Searching with GREP https://www.internetblog.org.uk/post/1566/searching-with-grep/ Fri, 23 Jul 2010 20:08:50 +0000 http://www.internetblog.org.uk/post/1566/searching-with-grep/ GREP, which stands for global regular expression print, is a sophisticated Linux/Unix tool that can serve many purposes, but one useful purpose on a dedicated server is its ability to search files and directories. With grep you can search within multiple files with relative ease. You can also parse printed screen data to simplify results.

To search a file, just enter “grep” followed by the search term and then the filename. For example, to search the file “httpd.conf” for the word “localhost”, you would type:

grep localhost httpd.conf

To use grep, to simplify printed screen lists, use the following format:

ls -al /usr/bin | grep make

This will list all of the files in the /usr/bin directory, but will only display those files that contain the word “make”. For more in-depth documentation, including use of regular expressions, type “man grep” from the command line.

Photo Source: Wikimedia Commons

]]>
Rsync Incremental Backups https://www.internetblog.org.uk/post/1560/rsync-incremental-backups/ Thu, 22 Jul 2010 16:31:33 +0000 http://www.internetblog.org.uk/post/1560/rsync-incremental-backups/ Question: How can I easily perform incremental backups on my dedicated server?

Answer: There are few tasks more important than backing up your server. Because of the nature of computers and especially the nature of the Internet, you are bound to have problems. They may or may not cause data loss, but that is not a chance you want to take.

Rsync is a tool that simply syncs the files in one directory with another. What makes it ideal for backups is that 1) it can archive files and compress them and 2) it can use SSH to perform the backups to remote servers.

To run an rsync backup, just execute the command like this:

rsync -avz ~/public_html username@hostname.com:/home/user/backupfiles/

This will backup, archive, and compress the files found in public_html on your server. Finally, it will send those archives to the remote server in the directory specified. The best part about rsync is that, the next time you perform a backup, it will only backup the files that have changed (i.e. incremental backups), saving you bandwidth and time.

]]>
How to Use Email Forwarding https://www.internetblog.org.uk/post/1552/how-to-use-email-forwarding/ Tue, 20 Jul 2010 19:03:03 +0000 http://www.internetblog.org.uk/post/1552/how-to-use-email-forwarding/

For example, you can forward all messages sent to billing@yourdomain, sales, and marketing all to the same address: tom@yourdomain. That way, Tom will handle those email messages accordingly without having to check each of those accounts separately.

Most web-based control panels have support for mail forwarding built into them. If, for some reason, you do not have that option, you can create forwards manually. To forward email from one address to another, use email aliases. To create aliases, edit the /etc/aliases file and add lines like the following:

billing: tom

That will forward all mail sent to “billing” to “tom”. Once you have created your alises, save the aliases file and run: “newaliases” from the command line.

Image Source: Wikimedia Commons

]]>
How to Force YUM to Exclude Certain Packages https://www.internetblog.org.uk/post/1546/how-to-force-yum-to-exclude-certain-packages-2/ Mon, 19 Jul 2010 18:13:41 +0000 http://www.internetblog.org.uk/post/1546/how-to-force-yum-to-exclude-certain-packages-2/ YUM logoYUM is a package management system for Red Hat Enterprise Linux (RHEL), CentOS, Fedora, and other Red Hat-based Linux operating systems. It is command-line driven and is an easy tool you can use to keep your server updated and install any new software you need.

Normally, when you perform updates, YUM will search the distribution’s online repository and select any newly updated packages for download and installation. These may include everything from Apache web server to the Linux kernel itself.

Most of the time, it is a general good practice to update all of the available packages, but there are times when this may not be ideal. For example, if you know for certain that a new version of a particular package that you have installed will not work with a version of one of your web applications, you may want to delay updating until you have patched your application. Another possible scenario is that you may want to update most of your other packages now but wait until later to update the kernel, which will require a reboot.

YUM has a built-in feature that allows you to exclude a package or group of packages of your choosing. You can either use the exclude function on a long-term basis or for one particular update. To make a long-term change, you should edit your repository file (usually yum.conf). Find the [main] section and add the following line:

exclude=package1* package2 package3*

A name by itself will exclude only that package. The “*” after some names will exclude any packages with those words in it.

To exclude specific packages for a single update, you can use the exclude flag from the command line:

yum --exclude=packagename* update

If you later decide to proceed with updating that package, just run update without the exclude flag.

]]>
How to Fix an Open Relay in Postfix https://www.internetblog.org.uk/post/1541/how-to-fix-an-open-relay-in-postfix/ Fri, 16 Jul 2010 16:58:02 +0000 http://www.internetblog.org.uk/post/1541/how-to-fix-an-open-relay-in-postfix/ postfix

As I have been reiterating all week, an open relay is a bad idea. If your mail server is left open, anyone can use your SMTP service to send mail, and spammers will use it. This can result in your server being blacklisted and extraneous use of system resources that neither benefit you nor your users.

To secure Postfix, there are a number of functions you can add the configuration file /etc/mail/main.cf. Edit the file and add the following lines:

smtpd_helo_required = yes
smtpd_delay_reject = no
disable_vrfy_command = yes

smtpd_helo_restrictions = permit_mynetworks,
reject_invalid_hostname,
reject_unknown_hostname,
reject_non_fqdn_hostname

This will force incoming requests to pause and identify themselves before proceeding, and will allow properly authenticated users to pass through and send mail. To finish, save the file and restart Postfix:

/etc/init.d/postfix restart

]]>
How Do Spammers Send Spam from My Server? https://www.internetblog.org.uk/post/1536/how-do-spammers-send-spam-from-my-server/ Thu, 15 Jul 2010 17:31:56 +0000 http://www.internetblog.org.uk/post/1536/how-do-spammers-send-spam-from-my-server/ Wall of real spam
When your server has become a haven for spammers, it is never a pleasant ordeal. Your server will probably be blacklisted, causing many of the emails you send to bounce back, and you may have serious connection problems due to the spammer using valuable system resources.

There are a couple of ways in which spammers will use a server to send their emails. The first is through an open relay in your mail server. This is something that you can easily fix in both Postfix and Sendmail. I will post more about fixing an open relay tomorrow. The second method is by signing up for a legitimate hosting account with your web hosting service, but then using the account to send spam. By the time you figure out what they have done, they are usually long gone.

The third and probably most nefarious method of sending spam from your server is through an actual attack on your server. When a hacker finds a hole in your security, they will install a bot on the server. That bot will then act as a small mail server for the hacker, all without your knowledge. You may not even notice it unless it causes some side effects. All three methods should be fixed with increased security and careful scanning of your server for possible threats.

Photo Source: Flickr

]]>
How to Remove Software in Linux https://www.internetblog.org.uk/post/1531/how-to-remove-software-in-linux/ Wed, 14 Jul 2010 19:22:06 +0000 http://www.internetblog.org.uk/post/1531/how-to-remove-software-in-linux/ Delete icon
Question: How do I remote software that I installed from my Linux dedicated server?

Answer: The answer to that question depends on how you installed the software in the first place. Once you establish how and where the software has been installed, you can determine how to remove it.

1. Package Manager – Most software should be installed with a package manager like YUM or Apt. If that is the case, you remove it with the normal command for the package manager:

yum remove [packagename] apt-get remove [packagename]

2. Manual Deb, RPM, etc – If you installed a distribution package manually, you can remove it manually or use your package manager to remove it.

3. Binary Archive – If you were given a tar.gz or similar package with binaries inside, and you unpacked them to a directory, simply remove the directory. If the package had an installer program, try using that to uninstall it.

4. Source – If you compiled the software from source and used “make install” to install it, removing it may be more tricky. If you still have the source files, you can simply run “make uninstall”. Otherwise, you will have to find out where the files were installed and remove. They may be in several directories.

]]>
Troubleshooting Database Connections https://www.internetblog.org.uk/post/1521/troubleshooting-database-connections/ Mon, 12 Jul 2010 19:17:37 +0000 http://www.internetblog.org.uk/post/1521/troubleshooting-database-connections/ Drupal database connection error
When MySQL works correctly, it can be a thing of beauty, but when something goes wrong, it can drive you mad. Here are a few things you can do to troubleshoot connection problems:

1. Make sure your username and password are correct.
2. Double-check the hostname. Although “localhost” works on most servers, it may not on yours.
3. Test the connection string (if you wrote the code yourself). You may have a simple typo.
4. If you have your own server, check the mysql server to see if it is running and running without errors.
5. Does the database you are trying to connect to actually exist? Sometimes automatic database creation fails, and you are left wondering why you cannot connect to it.
6. If you can connect locally but cannot connect remotely, check your firewall settings to see if port 3306 (or whichever port you use for mysql) is open.
7. Finally, be sure your mysql user has the necessary privileges to perform whatever task you are trying to accomplish.

Photo Source: Flickr

]]>
What is a Linux Package? https://www.internetblog.org.uk/post/1520/what-is-a-linux-package/ Mon, 12 Jul 2010 19:13:06 +0000 http://www.internetblog.org.uk/post/1520/what-is-a-linux-package/
linux packageQuestion
: I have a new Linux dedicated server, and I have read a lot of documentation referring to packages. What are Linux packages?

Answer: In Linux distributions, a “package” refers to a compressed file archive containing all of the files that come with a particular application. The files are usually stored in the package according to their relative installation paths on your system. Most packages also contain installation instructions for the OS, as well as a list of any other packages that are dependencies (prerequisites required for installation.

Common types of Linux packages include .deb, .rpm, and .tgz. Since Linux packages do not usually contain the dependencies necessary to install them, many Linux distributions use package managers that automatically read dependencies files and download the packages needed before proceeding with the installation. Some examples of package managers are APT, YUM, and Pacman.

]]>
How to Delete Tables and Rows in MySQL https://www.internetblog.org.uk/post/1516/how-to-delete-tables-and-rows-in-mysql/ Fri, 09 Jul 2010 15:51:41 +0000 http://www.internetblog.org.uk/post/1516/how-to-delete-tables-and-rows-in-mysql/ mysqlAs I mentioned in a previous MySQL post, knowing how to quickly perform database tasks from the command line is a good idea if you are a Linux system administrator. Sometimes, it is the easier way to get things done, especially if you are helping another user and need root access to his or her database.

To delete a table, first login to MySQL:

mysql -u root -p

Enter your password and then switch to the database you want to edit by typing the following at the mysql> prompt:

mysql> use [db name];

Finally, drop the table:

mysql> drop table [table name];

Replace [table name] with the actual name of the table you want to remove.

To remove a row, type:

mysql> DELETE from [table name] where [field name] = 'whatever';

When you are finished, type “quit” to exit.

]]>