Cloud Hosting

How to Install wget on CentOS 6.7 with a wget Cheat Sheet

Ray Leon September 3, 2015 by under Cloud Hosting 0 Comments
Verified and Tested 09/03/2015

Introduction

In this quick and simple article, we will install wget command on a CentOS 6.7 server and we have included a wget cheat sheet. Wget is a free software package for downloading files using HTTP, HTTPS and FTP.

Prerequisites

A CentOS 6.7 server with Root privileges. If you do no have a server, you can spin up an efficient and reliable SSD Cloud server from Atlantic.Net.

Read More


Why Businesses & Developers Choose WordPress

Adnan Raja September 2, 2015 by under Cloud Hosting 0 Comments
  • The Incredible Scope of WordPress
  • The Price is Right
  • Ready to Use Off-the-Shelf
  • Choose Your Own Adventure
  • SEO-Friendliness
  • Security
  • User-Friendliness
  • Support When You Need It
  • Multimedia Integration
  • Immediate Access to Fast WordPress hosting

The Incredible Scope of WordPress

Popularity certainly isn’t the only factor when choosing a content management system (CMS), but a quick look at the statistics shows that WordPress certainly has that base covered. In 2011, WordPress was used on 14.7% of the top 1 million sites worldwide. At that time, there were about 500,000 WordPress posts each day. According to Technorati, 48 of the top 100 blogs were using WordPress, and it was translated into 40 languages. Still today, WordPress is a massive presence on the Internet.

Read More


How to : Authoritative BIND9 DNS Server on CentOS 6 : Install & Configuration

Stephen Flynn September 2, 2015 by under Cloud Hosting 0 Comments

Introduction

In this how-to article, we will walk you through the installation of a secure BIND9 authoritative DNS server on CentOS 6.7

What is BIND?

BIND is open source software that implements the Domain Name System (DNS) protocols for the Internet. It is a reference implementation of those protocols, but it is also production-grade software, suitable for use in high-volume and high-reliability applications.
ISC (Internet Systems Consortium)

Read More


How to Install MediaWiki on Ubuntu 14.04

Arnaldo Arrieta September 1, 2015 by under Cloud Hosting 0 Comments

Introduction

MediaWiki is a wiki application written in PHP that the Wikimedia Foundation developed to run several of their projects. The encyclopedia Wikipedia is the most popular of these projects.

A wiki is a type of website that allows its users to create and edit content in a collaborative manner. It can be used in several ways, including as a knowledge base, documentation library, community website, or company intranet.

These kinds of websites are especially useful in contexts where several people need to create and modify pages in a quick and easy way.

This guide will show you how to install and set up the application, giving you the basis to deploy your own wiki site.

We will use the domain name “example.com” in this guide. Replace it with the domain name or IP address you have configured on your server.

 

Prerequisites

– An Ubuntu 14.04 server. You can run MediaWiki on a different flavor of GNU/Linux, but the steps outlined below could differ. If you do not have one, why not spin up a fast SSD Cloud server from Atlantic.Net.

Installing MediaWiki on Ubuntu 14.04

Before you begin, make sure your system is updated. From the command line, type:

sudo apt-get update
sudo apt-get upgrade

Proceed to install the package:

sudo apt-get install mediawiki

The package management system will install all the dependencies required.

The MySQL database server is one of these dependencies. If MySQL is not already installed on your server, then the installer will prompt you for a password for the root MySQL user. Remember to choose a unique, secure password, different from the server user’s. Keep this password handy. You’ll need it again later during this installation.

 

There are also certain optional software packages used by MediaWiki that could be installed at this time. Although optional, they do provide useful features:

Imagemagick: a package used to create image thumbnails.
PHP5-intl: a PHP extension used for Unicode normalization.
PHP-apc: a package that provides cache features to PHP.

 

To install these optional packages, from the command line:

sudo apt-get install imagemagick php5-intl php-apc

 

Initial Configuration of MediaWiki

There are several configuration tasks to perform both on the server and with the guided web GUI before you will be able to use the wiki.

Configure Apache

The first step is to configure the Apache web server.

Using your preferred text editor, open the /etc/mediawiki/apache.conf file and uncomment the line beginning with Alias.

# Uncomment this to add an alias.
# This does not work properly with virtual hosts..
Alias /mediawiki /var/lib/mediawiki
# Uncomment the following line (instead of the one above)
# to use the custom directory '/intranet'
#Alias /intranet /var/lib/mediawiki

<Directory /var/lib/mediawiki/>
    Options +FollowSymLinks
    AllowOverride All
    <IfVersion >= 2.3>
            Require all granted
    </IfVersion>
    <IfVersion < 2.3>
            order allow,deny
            allow from all
    </IfVersion>
</Directory> 
[remaining configuration cut]

With this setting, the wiki will be accessible using a web browser and going to the /mediawiki directory under your domain or IP address.

If you want to change the “/mediawiki” directory, simply replace the first “mediawiki” appearing in that line. Leave the second as it is because it is indicating the path where the files are located. There is a second Alias line included in the example above to demonstrate the configuration necessary to make your wiki accessible at www.example.com/intranet/.

 

The second step is to tell the Apache web server to use the file you just modified. Edit the Apache main configuration file /etc/apache2/apache2.conf. At the end of the file, add the following line:

Include /etc/mediawiki/apache.conf

Finally, restart Apache to apply the changes. From the command line:

sudo apache2ctl restart

 

Configure MediaWiki

Using your web browser go to http://www.example.com/mediawiki.

If you changed the alias before, use the name you chose (from our example: http://www.example.com/intranet/).

 

MediaWiki initial setup page

MediaWiki initial setup page

MediaWiki will now show its version. It will also say “LocalSettings.php not found”. We’ll be creating that file based on the next few steps. Get started by clicking on the link to “set up the wiki”.

Language

MediaWiki installation: language selection

MediaWiki installation: language selection

On this page, you can choose the language for your wiki. Select your preferred options and click “Continue”.

If you are curious about any of the parameters MediaWiki is asking you to select, you can click on the “help” link next to each input or selection field to open a short help window explaining its purpose.

 

Welcome

At this point, MediaWiki performs several checks before proceeding with the configuration.

If all is OK, the message “The environment has been checked. You can install MediaWiki” will appear. Press “Continue” to advance to the next step.

MediaWiki installation: environment checks complete

MediaWiki installation: environment checks complete

The wiki installer will let you know if some of the optional software packages are missing, but it will let you continue anyway.

Connect to Database

In this step, you must provide the information to establish the connection with the database.

Enter the MySQL root password in “Database password” and click on “Continue”.

MediaWiki installation: initial database settings

MediaWiki installation: initial database settings

Creating the database and tables MediaWiki uses requires the MySQL root account (here’s where you’ll need that password from above). On the next screen, you will be able to tell MediaWiki to use another MySQL user for its normal operation.

Database Settings for MediaWiki

Uncheck “Use the same account as for installation” and enter a username and password for the MySQL account you will use to run MediaWiki. If the user does not exist yet, be sure to check the box for “Create the account if it does not already exist”.

On this screen, there are other settings related to the database. If you do not have special reasons for changing them, just leave the defaults options and click “Continue”.

MediaWiki installation: new database settings

MediaWiki installation: new database settings

 

Name

Input the name for your wiki, and the administrator account settings.

Leave the “Ask me more questions” selected and click “Continue”.

MediaWiki installation: administration settings

MediaWiki installation: administration settings

 

Options

Select the options that best fit your needs and press “Continue”. If you need help making your selection, remember to take a look at the “help” links that provide more information about each option.

Complete the Installation

MediaWiki now has all the configuration settings it needs to finish the installation process. If it does not detect any problems, it will proceed to commit these changes into a file called “LocalSettings.php”. You will then see a prompt to download the file to the system you are running your browser on.

MediaWiki installation: LocalSettings.php file download

MediaWiki installation: LocalSettings.php file download

The last step requires you to copy the downloaded file to the /etc/mediawiki folder of your MediaWiki server.

You can transfer the file via something like scp or Filezilla, for example. You could also create the LocalSettings.php file on the MediaWiki server with your preferred text editor and copy and paste the contents from the file you just downloaded.

Security Tip:

Once you have added the configuration file into your server, you should change its owner/group and adjust its permissions. The Apache default user and group (www-data) should have ownership over this file. The permissions should let only that user read and write the file. From your server command line run:

sudo chown www-data:www-data /etc/mediawiki/LocalSettings.php
sudo chmod 600 /etc/mediawiki/LocalSettings.php

 

Once you have completed this last step, back in your browser click the “enter your wiki” link. Or just access www.example.com/mediawiki/ (if you used a custom alias, then use that term instead, e.g. www.example.com/intranet/).

Now your wiki is ready to be used.

MediaWiki successfully installed

MediaWiki successfully installed

 

Changing the logo

Although instruction about further tuning your wiki exceeds the purpose of this guide, there is a quick customization you might want to make at this moment: change the logo that appears by default.

According to the MediaWiki documentation, a good logo size is 135x135px or 150x150px. Bigger sizes will get cut off.

Copy your logo image file to /var/lib/mediawiki/skins/common/images.

Open /etc/mediawiki/LocalSettings.php with the text editor of your choice and edit the $wgLogo line. Replace the last part of the path with the name of the file you copied. For example:

$wgLogo             = "$wgStylePath/common/images/mylogo.png";

Save the change and access your wiki one more time. Your wiki will now display your custom logo.

More Resources

The default main page of your wiki includes several useful links where you can learn more about all the features included with MediaWiki and the ways to use it.

An excellent starting point is the MediaWiki User’s Guide.

Thank you for following along this how-to, please check out our other related articles at the bottom of the page.


How to Vim Tips for Beginners (or, Help! I Have To Use Vim!)

Atlantic.Net NOC August 31, 2015 by under Cloud Hosting 0 Comments

Introduction

Perhaps you are happily configuring a cloud server or following along in an online tutorial, and you end up, by accident or by necessity (I’m looking at you, Minimal Install), having to use a text editor like Vi or Vim. Do you break out into a cold sweat? Do you get the shakes? Do you feel the uncontrollable urge to flip the desk?

Frustrated non-Vim user

Photo: Peter Hess / licensed under CC BY 2.0

It happens. Vim (I’ll be using “Vim” from here on out, since these tips can be used in either Vi or Vim) can be a confusing landscape to navigate. Devotees may swear by it, but for most of you, it is the text editor of the Beast and should be avoided at all costs. Except when it can’t. For those situations, this quick reference will try to help you navigate your way back to what must seem like much saner pastures.

Prerequisites

– New to Vim
– Fear/hatred of Vim
– Stuck in Vim
– I don’t want to learn it, I just want to get on with life!

Quick Links

Typing
Exiting
Navigation
Find/Replace
Delete
Undo
.

Why can’t I just type in Vim?

Vim works in different modes in which the keyboard keys can perform different actions based on the mode you’re in (kind of the way a game controller’s controls might behave differently in a game based on whether you are flying a plane or running through ancient ruins).

Vim generally starts in “Normal” mode, where many of the keys are mapped to different actions (some of you may consider the name of this mode an oxymoron).

To get to a mode where you can just start typing–called “Insert” mode in Vim world–type:

i

You should see “– INSERT –” show up in the lower left of your screen.

Vim insert mode

Vim insert mode

Most instances of Vim will provide this context clue to help you identify what mode you are in. Some older instances of Vi, though, do not present this clue. Even Vim users hate it when we find ourselves in this situation.

For all you Vim grognards, yes, there are other ways to enter “Insert” mode. This is arguably the most straightfoward. And how did you get here?

 

To get back to “Normal” mode (which is important if you want to save, quit, or executate any of the other actions below), press ‘Esc’.

Note: The remaining tips will be executable in “Normal” mode, so remember to ‘Esc’ out of “Insert” mode before trying to complete these actions!

.

Exit Vim

“I accidentally ended up in Vim and want to quit!”:

:q   [then press 'Enter]

“But I’ve made some changes I want to keep before I quit”:

:wq   [then press 'Enter']

“I just want to get out and I don’t care to save any changes I might have accidentally made while mashing keys!”:

:q!   [then press 'Enter']

.

Navigation in Vim

Go to the top of the document:

gg

 

Go to the bottom of the document:

G

 

Navigation, measured by page:

Ctrl+u   [Up by half a page]
Ctrl+b   [Back by a full page (equivalent to 'Page Up')]

Ctrl+d   [Down half a page]
Ctrl+f   [Forward by a full page (equivalent to 'Page Down')]

.

Find and Replace in Vim

“I need to find a particular string” (e.g., waldo):

/waldo   [then press 'Enter']

To find the next occurence of the string you are searching, press ‘n’ (as in “next”). If you’ve gone too far, you can cycle backwards through matches with a capital ‘N’ (as in…, “NO! Too far! Go back!”)

 

To replace all instances of one string with another (e.g., find all references to “waldo” and replace with “carmen sandiego”):

:%s/waldo/carmen sandiego/gc   [then press 'Enter']

The ‘c’ at the end of this command will ask you for confirmation for each replacement before continuing (use the standard ‘y’ and ‘n’ to confirm or deny each substitution). If you leave the ‘c’ off, it will replace all instances without confirming.

.

Delete in Vim

To delete a line of text, make sure your cursor is somewhere in the line you want to delete:

dd

You can use this command to delete multiple adjacent lines, as well. Just place your cursor in the first line you’d like to delete, then prepend the number of lines to delete before the dd (e.g., to delete 10 lines, 10dd).

.

Undo in Vim

To undo the last thing you did, type:

u

You can keep pressing ‘u’ to undo each previous action, at least as far back as your session’s buffer goes (so, for example, you could undo the changes you made, but not the changes you or another user made before last editing the file).

 

Care To Learn More?

If you’ve made it this far, I hope you have found some of these tips useful. If you’re interested in perhaps dipping your toe a little further into the Vim pool, you can, on the command line of a Linux device with Vim installed, type vimtutor to start some guided lessons. Or, if you prefer something a little less intimidating, you could always try the game Vim Adventures!


What is: Javascript Frameworks – An Introduction

Siddharth Gutta August 28, 2015 by under Cloud Hosting 0 Comments
Target Audience:

This article assumes only a basic familiarity with front-end web development and serves as an introduction to JavaScript in modern web development.

Introduction

Javascript code

Photo: Dmitry Baranovskiy / licensed under CC BY 2.0

The web is evolving. Websites, and more specifically, web design paradigms are changing constantly, and front-end developers must be aware of the latest trends in development to create the best projects. The tried and true languages of the web have been HTML, CSS, and JavaScript for nearly two decades. That still holds true today. How these languages are implemented has changed signficiantly, though, and none more so than JavaScript. JavaScript is seen the most today via web browsers, where client-side scripts interact with users.

Modern websites and web apps rarely, if ever, utilize pure Javascript. Rather, developers have created new frameworks with JavaScript that speed up development, improve functionality, and allow for the creation of agile, modern web apps. This article serves as an introductory overview of the concept of frameworks.

JavaScript Frameworks vs. Libraries

Understanding JavaScript frameworks necessitates an understanding of JavaScript libraries and the differences between the two. Often, the terms are used interchangeably, but each has its own particular role to play despite some overlap that may occur. A library is a set of pre-written code that acts as a toolkit for a developer. For example, jQuery–which aids in handling events or creating animations, among many other benefits–is one of the most used JavaScript libraries. Libraries, while useful, do not impose any structure onto a developer’s code. Frameworks, in contrast, impose structure and what this structure actually does will be discussed in the next section.

JavaScript frameworks are tools designed to speed up development and organize code used to build modern web apps. They exist to solve problems more directly rather than providing an open set of tools like most libraries do. The earliest frameworks were created to help manage what were becoming large and unwieldy codebases and to simplify the process of creating dynamic web apps that do not function like traditional server-side web apps.

Why are JavaScript Frameworks important?

Web apps have exploded in popularity over the past decade. Companies like Twitter and Airbnb don’t require you to download specific software to your devices (outside of mobile apps) to use their services. Rather, they have created web interfaces their users interact with. Web apps from these companies and countless others incorporate client-side loading to create a smoother user experience. Coding these modern web apps, even small ones, requires a large amount of JavaScript to create the desired client-side functionality. As web apps had increased in popularity, developers noticed that they were writing nearly the same code over and over again to produce the same basic features. They realized that it would be a lot more efficient to have tools to speed up this process.

What JavaScript frameworks help create are MVCs. An MVC (Model View Controller) is a concept that is key in developing structured user interfaces with client-side loading functionality. Constructing complex user interfaces that run in a web browser is incredibly time consuming, and you’ll likely write similar code that has been written over and over again. JavaScript frameworks serve to organize JavaScript for apps looking to quickly perform tasks client-side without constantly going to a cloud server.

These Frameworks help give web applications structure and cut down time spent working to create new MVCs. They may contain several libraries attempting to simplify everything from templating to working with Document Object Models. Each framework contains different libraries and tools that best suit different types of web apps. Understanding why JavaScript frameworks were first developed is extremely helpful when trying to learn more about individual ones and comparing them to each other.

We hope you have enjoyed this introduction to Javascript frameworks. Please check back with us for new updates soon and check out our exciting cloud hosting solutions and our one-click cloud hosted applications.


How to Install Nginx on CentOS 6.7

Jose Velazquez August 27, 2015 by under Cloud Hosting 0 Comments
Verified and Tested 08/27/15

Introduction

This how-to will walk you through installing Nginx on CentOS 6.7.  Nginx is a powerful web server software that can be used on your server. It is also known for its high performance and low memory usage which will allow fewer resources to be used but getting the job done efficiently.

What Do You Need?

You need a CentOS 6.7 server that is configured with a static IP address. If you do not have a server already, you can visit Atlantic.Net Cloud Hosting page and spin up a reliable cloud server in under 30 seconds

Server Preparation

To get started, login to your CentOS 6.7 via SSH or the VNC Console in cloud.atlantic.net. Atlantic.Net Cloud servers are set up as minimal installations in order to avoid having unnecessary packages from being installed and never used. Because of this, let’s make sure that your server is fully up-to-date.

sudo yum update

With the server up-to-date, we can continue the installation process of your server.

Install EPEL and Nginx on CentOS 6.7

In order to install Nginx, we will need to use the apt-get command so we can install the software. Also, we will need to install EPEL in order for the Nginx installation installs correctly.

Run the command to install the EPEL:

sudo yum install epel-release

Run the command to install Nginx:

sudo yum install nginx

Run the command to start the service:

sudo /etc/init.d/nginx start

To make sure that Nginx starts when rebooted, insert the following:

chkconfig nginx on

You will now have NGINX installed on your server. This can be verified by typing in the following with your IP ADDRESS on your browser (http://YOUR.IP.ADD.RESS )

This is the default webpage when installing Nginx on CentOS 6.7

This is the default webpage when installing Nginx on CentOS 6.7

What Next?

You now have your CentOS 6.7 server with Nginx installed. You can now begin building high performance websites using your newly installed web server.

Thank you for following along in this How-To! Check back with us for any new updates and try any of our industry-leading cloud hosting solutions.


How to Set up a Minecraft Server on CentOS 6.7

Atlantic.Net NOC August 26, 2015 by under Cloud Hosting 0 Comments
Verified and Tested 02/04/2015

Introduction

This guide will walk you through setting up a Minecraft (version 1.8.1) server on CentOS6.7 64bit with nifty startup and shutdown scripts for easy management.

Prerequisites

A CentOS 6.7 64-bit server, if you do not have a server then spin up a super fast Minecraft server today!

Setting up a Minecraft Server on CentOS 6.7

First, we install our prerequisite software:

yum install nano java-1.8.0-openjdk screen wget -y

Now, we create and enter the directory that the server will reside in:

mkdir /Minecraft cd /Minecraft/

Next, we download the actual Minecraft server application and make it executable:

wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8.1/minecraft_server.1.8.1.jar
chmod +x minecraft_server*.jar

Agree to the EULA that you definitely read:

echo 'eula=true' > eula.txt

The next steps are to create a handy script that allows us to start the server without remembering any arbitrary Java or screen CLI syntax:

echo 'cd /Minecraft' > /usr/bin/startcraft
echo '/usr/bin/screen -d -m sh -c "/usr/bin/java -Xmx768M -Xms768M -jar /Minecraft/minecraft_server.1.8.1.jar nogui"' >> /usr/bin/startcraft

Depending on the size of the server, you may want to adjust the “Xmx” and “Xms” values. These are the amount of RAM allocated to the Minecraft server instance. Mojang recommends 1GB of dedicated RAM, but you can get away with less if there will be very few people on at once.
If you end up upgrading the server in the future, or just wish to change the value after following this tutorial, simply use “nano” to edit the startcraft command:

nano /usr/bin/startcraft

Now we make “startcraft” executable:

chmod +x /usr/bin/startcraft

Now let’s test that this half of the setup is working:

startcraft
screen –r
Sample Output

Sample Output

You should now see some text detailing that the server is starting/has started. Use Control + A then D to detach from the screen.

For the final step of the basic setup, we open up the default Minecraft port on the firewall:

iptables -I INPUT 1 -p tcp -m tcp --dport 25565 -j ACCEPT iptables-save > /etc/sysconfig/iptables

To stop the server process gracefully, we would need to enter the screen session:

screen –r

Although we are not at a prompt, we can still type Minecraft server commands here (/give, /op, etc). The command to stop the server is simply “stop.” When it has completed the shutdown process, the screen session will terminate. To run the server once again, just type “startcraft

Alternatively, we can setup a simple script to inject the “stop” command into the screen session:

echo 'screen -p 0 -X stuff "stop$(printf \\r)"' > /usr/bin/stopcraft chmod +x /usr/bin/stopcraft

To stop the server now, simply run “stopcraft” anytime:

stopcraft

Now you can start and stop the server with single commands without ever having to type out java stuff or jump into screen!

Don’t forget to give your username OP status. This can be done without touching screen with the following command:

screen -p 0 -X stuff "op USERNAME$(printf \\r)"

Replace “USERNAME” with your username.
Once you have it, you can perform any commands including /op while in-game. Depending on the circumstances, you may need to log into the server in the Minecraft game before you can OP yourself.

If you wish to have the “startcraft” script run when the server starts, simply run this command:

echo '/usr/bin/startcraft' >> /etc/rc.d/rc.local

The next step you will likely want to take is to point a DNS record to your server’s IP for easy connecting/distribution. You can read about using our cloud DNS manager here: https://www.atlantic.net/community/howto/manage-cloud-dns-records/

Finished! This page details all of the options you can modify in your “/Minecraft/server.properties” file: http://minecraft.gamepedia.com/Server.properties

Happy crafting! Be sure to contact us for all of your Cloud hosting needs!


How to Change Your Hostname in CentOS 6.7

Atlantic.Net NOC August 25, 2015 by under Cloud Hosting 0 Comments

Verified and Tested 8/25/15

Introduction

In this article, we discuss how to change your server’s hostname in CentOS 6.7, is a label given to a device that is connected on a network.

Note: The scope of this article does not extend to updating your DNS name, so if you want your server reachable via its DNS name, you will still need to ensure DNS is configured correctly.

Prerequisites

Server running CentOS 6.7  If you do not have a server, consider spinning up a powerful cloud hosting server from Atlantic.Net.

Modify your hostname in CentOS 6.7

If you’d like to change your CentOS server’s hostname, you’ll need to change it in a few places.

Open up the /etc/sysconfig/network file with your text editor of choice:

sudo vim /etc/sysconfig/network

Change the HOSTNAME argument to the hostname you’d like to use. Here, we’ll be changing the old hostname of ‘bespin’ to ‘endor’. See below for more information on valid hostnames:

1
2

This change will take effect the next time you reboot your server. Before you do, though, you might want to also add the hostname to your /etc/hosts file.

Again, with your text editor of choice:

sudo vim /etc/hosts

In this instance, we’ll add our new hostname ‘endor’ to the entry for the loopback address 127.0.0.1 (and for fun, for the IPv6 loopback). We might also add an entry for an IP address configured on this server:

3At this point, the next time you reboot your server, your new hostname would show up in your command prompt and would also show up with the ‘hostname’ command. If you would rather not reboot your server, you can change the hostname with the ‘hostname’ command:

sudo hostname yourhostname

4

You may change the hostname with this command alone, but the next time you reboot your server, it would not be persistent and would load whatever hostname is still in the /etc/sysconfig/network file.

Also, you may notice that the hostname in your command prompt hasn’t changed. If you’re the sort who’s going to be annoyed by that (or, if you’d like to avoid the confusion of seeing the old hostname in the command prompt), then log out of the current session. When you log back in, the new hostname will show up in the command prompt.

One other caveat: until you do reboot your server after a hostname change, you may also notice that your logs still use the old hostname.

Valid Hostname Restrictions

In each of these configurations, you’ll need to be sure your hostname conforms to the standards for FQDNs (Fully Qualified Domain Names). The ASCII letters a – z, the digits 0 – 9, and the hyphen (‘-‘) are the only characters acceptable (the first character, however, cannot be a hyphen). You may also find it necessary (or useful) to include the domain name as well, in which case you would then also use periods (dots) to separate the hostname and the domain name (and top-level domain). So the following would be acceptable examples:

bespin.the-empire.starwars

endor.rebelalliance.starwars

The whole hostname should be no more than 255 characters (see RFC1123).

What Next?

With that, you now have a server with a hostname. Thank you for following along and feel free to check back with us for further updates, or check out our other CentOS guides.


How to Change Your Hostname in CentOS 6.7

Atlantic.Net NOC August 25, 2015 by under Cloud Hosting 0 Comments

Verified and Tested 8/25/15

Introduction

In this article, we discuss how to change your server’s hostname in CentOS 6.7, is a label given to a device that is connected on a network.

Note: The scope of this article does not extend to updating your DNS name, so if you want your server reachable via its DNS name, you will still need to ensure DNS is configured correctly.

Prerequisites

Server running CentOS 6.7  If you do not have a server, consider spinning up a powerful and affordable server from Atlantic.Net.

Modify your hostname in CentOS 6.7

If you’d like to change your CentOS server’s hostname, you’ll need to change it in a few places.

Open up the /etc/sysconfig/network file with your text editor of choice:

sudo vim /etc/sysconfig/network

Change the HOSTNAME argument to the hostname you’d like to use. Here, we’ll be changing the old hostname of ‘bespin’ to ‘endor’. See below for more information on valid hostnames:

Change hostname in Centos
Change hostname in Centos

This change will take effect the next time you reboot your server. Before you do, though, you might want to also add the hostname to your /etc/hosts file.

Again, with your text editor of choice:

sudo vim /etc/hosts

In this instance, we’ll add our new hostname ‘endor’ to the entry for the loopback address 127.0.0.1 (and for fun, for the IPv6 loopback). We might also add an entry for an IP address configured on this server:

Change hostname in CentosAt this point, the next time you reboot your server, your new hostname would show up in your command prompt and would also show up with the ‘hostname’ command. If you would rather not reboot your server, you can change the hostname with the ‘hostname’ command:

sudo hostname yourhostname

Change hostname in Centos

You may change the hostname with this command alone, but the next time you reboot your server, it would not be persistent and would load whatever hostname is still in the /etc/sysconfig/network file.

Also, you may notice that the hostname in your command prompt hasn’t changed. If you’re the sort who’s going to be annoyed by that (or, if you’d like to avoid the confusion of seeing the old hostname in the command prompt), then log out of the current session. When you log back in, the new hostname will show up in the command prompt.

One other caveat: until you do reboot your server after a hostname change, you may also notice that your logs still use the old hostname.

Valid Hostname Restrictions

In each of these configurations, you’ll need to be sure your hostname conforms to the standards for FQDNs (Fully Qualified Domain Names). The ASCII letters a – z, the digits 0 – 9, and the hyphen (‘-‘) are the only characters acceptable (the first character, however, cannot be a hyphen). You may also find it necessary (or useful) to include the domain name as well, in which case you would then also use periods (dots) to separate the hostname and the domain name (and top-level domain). So the following would be acceptable examples:

bespin.the-empire.starwars

endor.rebelalliance.starwars

The whole hostname should be no more than 255 characters (see RFC1123).

What Next?

With that, you now have a server with a hostname. Thank you for following along and feel free to check back with us for further updates, or check out our other CentOS guides.


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources

We use cookies for advertising, social media and analytics purposes. Read about how we use cookies in our updated Privacy Policy. If you continue to use this site, you consent to our use of cookies and our Privacy Policy.