linux – 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 linux – Internetblog.org.uk https://www.internetblog.org.uk 32 32 Server OS Tips https://www.internetblog.org.uk/post/1588/server-os-tips/ Thu, 29 Jul 2010 23:18:18 +0000 http://www.internetblog.org.uk/?p=1588 Getting the right hardware and network setup for your server is difficult enough. Choosing the right operating system, configuring it, and then maintaining it can be overwhelming. Here are a few tips to get you through the process.

1. If you are on a limited budget, you should definitely consider a free and open source operating system like Linux, FreeBSD, or OpenSolaris.

2. You can support your own server if you have the technical knowledge. Otherwise, you should get a commercial operating system (open source or proprietary) that comes with support.

3. Make sure the OS you choose is one you can live with for a long time. It is never a good idea to change the server OS once the server is live.

4. Think long term. You want an OS that will be stable, updated, and supported for years to come.

5. If you are trying a new OS like Linux for the first time, test it using a virtual machine like Virtualbox. You can learn a lot from it before ever even installing it on your server.

6. Make sure the software and web applications you want to run will be compatible with the server operating system you choose. You do not want to find out that they are not compatible after the fact.

7. Paying more will not necessarily get you better quality. Weigh the pros and cons of features, security, and stability to make your decision.

Photo Source: Flickr

]]>
Server Maintenance Tips https://www.internetblog.org.uk/post/1580/server-maintenance-tips/ Wed, 28 Jul 2010 16:02:01 +0000 http://www.internetblog.org.uk/post/1580/server-maintenance-tips/ Over the course of the past year, we have covered many dedicated server maintenance issues, particularly for servers running Linux. In no particular order, here is a list of some of the more important tips you should remember when taking care of your server.

1. When possible, rely on the distribution updates and repositories. Only add third-party software when absolutely necessary.

2. Periodically run fsck to check the file system.

3. Monitor system and service logs.

4. Disable unused services.

5. Periodically optimize MySQL databases.

6. Monitor CPU and RAM usage.

7. Optimize RAM and swap usage.

8. On larger servers, run the database server on a separate machine, optimize the servers for scalability, and consider using a CDN (Content Delivery Network).

Photo Source: Flickr

]]>
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

]]>
Easily Repeat Root Commands with History https://www.internetblog.org.uk/post/1561/easily-repeat-root-commands-with-history/ Thu, 22 Jul 2010 15:36:55 +0000 http://www.internetblog.org.uk/post/1561/easily-repeat-root-commands-with-history/ Password keys iconPreviously, I mentioned some of the benefits of using the “history” command to display any or all of your previous commands. On dedicated servers, whether Linux or Unix, that use “sudo” rather than “su” to become root, it can be aggravating when you type a long command string only to realize you forgot to type “sudo.”

One easy solution is to press the up arrow, move over to the beginning of the string, and add sudo. But there is an even easier way to replay the command with root permissions.

Right after you have entered the command missing sudo, just type the following:

sudo !!

This will automatically run the last command in the shell history with whatever you place before it (in this case “sudo”). It is quick, easy, and gets the job done. In fact, you can use “!!” any time you want to repeat the previous command. Log in to your server via SSH and give it a try.

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 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 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.

]]>
Extra Large Log Files https://www.internetblog.org.uk/post/1530/extra-large-log-files/ Wed, 14 Jul 2010 19:13:00 +0000 http://www.internetblog.org.uk/post/1530/extra-large-log-files/ Linux syslog file
Question: One of my Linux system log files has suddenly become very large (several hundred megabytes). What should I do?

Answer: The first thing to find out is what exactly is happening in the log files. To see the latest log activity for your web server error log, for example, you would run:

tail -f /var/log/httpd/error.log

If the file is expanding, you should see errors popping up. When you are finished looking at it, press CTRL-C.

The next step is to fix whatever error you are receiving. If it is enough to fill up several megabytes or even a gigabyte of log space, it is a recurring error that should be fixed. For a web server, repeated failed connections could be some type of denial of service (DoS) attack. For a mail server, numerous open connections could mean that someone is using your server to send spam. The key is to find out exactly what the root cause is and then fix it. If you want to clear the log file, run:

> /var/log/httpd/error.og

Your logs will be back to normal size once your server is running normally again.

]]>
How to Increase MySQL Memory Usage Above 4GB https://www.internetblog.org.uk/post/1527/how-to-increase-mysql-memory-usage-above-4gb/ Tue, 13 Jul 2010 19:11:35 +0000 http://www.internetblog.org.uk/post/1527/how-to-increase-mysql-memory-usage-above-4gb/ RAM memory modules
Question: My database server is timing out because MySQL seems to hang once it has used up 4GB of RAM, even though the server is equipped with 6GB. How can I make MySQL take advantage of the full 6GB available?

Answer: If your current server setup involves a 32-bit architecture or even just a 32-bit version of your operating system, the short answer is: you cannot. By design MySQL will not be able to use more than 4GB unless it is running on a 64-bit OS.

If you are running Linux, type ” uname -m ” from the command line to see whether or not you are using a 64-bit version. If you know for a fact that your server actually has 64-bit processors, you can reinstall Linux with a 64-bit kernel.

The other less-drastic measure you may be able to take is to install a PAE (Physical Address Extension) kernel, which will allow your server to access physical address space larger than 4 GB. Some distributions, such as CentOS offer PAE kernel packages that you can easily install.

Source: Webhostingtalk.com
Photo: 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.

]]>