Tagged: CentOS Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 11:01 am on August 14, 2015 Permalink | Reply
    Tags: CentOS,   

    Categories: Linux ( 95 )

    How to disable the user list at login on CentOS 7 

    Screen Shot 2015-08-13 at 10.51.47

    By default, CentOS 7 will display a list of all users on the system. Click on it, type in the password, and you’re in. This works well when you have a handful of users on the system.

    However, on systems with a lot of users, not everyone can be displayed in that list – and scrolling up or down is impossible (and even if it was, it’s impractical at best). The solution is to replace that list with a box to type in a user, much like what would happen when you choose the “Not Listed” option.

    Here’s how to do it:

    From the command line, login as root and create a file called /etc/dconf/db/gdm.d/00-login-screen. By default it does not exist.

    vi /etc/dconf/db/gdm.d/00-login-screen

    Now add the following lines to it and save the file:

    [org/gnome/login-screen]
    # Do not show the user list
    disable-user-list=true
    

    This will tell GNOME not to display the list anymore, and instead bring up a text box as shown below. For the change to take effect, we need to update GNOME with the following command:

    dconf update

    And that’s it!

    Screen Shot 2015-08-13 at 10.54.55





     
  • Jay Versluis 10:48 am on August 13, 2015 Permalink | Reply
    Tags: CentOS,   

    Categories: Linux ( 95 )

    How to enable automatic user logins in CentOS 7 and GNOME 

    CentOS-LogoIf you’ve read my previous article about how to enable automatic logins on CentOS 6, and it sounded a little daunting, you may be pleased to hear that it’s a little easier to accomplish the same thing on CentOS 7.1.

    If you’re using GNOME in a single user environment, and you’re confident that nobody else will use your system, you can enable auto-logins without the password questions like this:

    1. Login to GNOME as usual
    2. Find your name at the top right and click on it
    3. Now select Settings
    4. In the new window that opens, find Users
    5. Click on Unlock at the top right
    6. Select your own user and turn on Automatic Logins

    You need supervisor privileges to make this change. Next time you restart your system, you’re logged in automatically.

    Screen Shot 2015-08-13 at 10.19.12

    Thank you, CentOS!





     
    • eliashickman 2:26 am on March 14, 2016 Permalink | Reply

      I can’t get this to work. What is the command to launch the user/account UI? Is there another way to do this via systemd?
      I’ve tried editing /etc/gdm/custom.conf and it doesn’t work either.

      • Jay Versluis 7:39 am on March 14, 2016 Permalink | Reply

        Pass I’m afraid – on my system “it just works”.

    • andy ng 11:22 pm on March 12, 2017 Permalink | Reply

      Sorry, it just work once just after you boot up the system. If I logout the user, it won’t autologin again and shows me the login box !!

      • Jay Versluis 6:44 am on March 13, 2017 Permalink | Reply

        Tja… not sure what to suggest, it works for me reliably every time. Did you speak to the CentOS people? Perhaps it’s a bug?

  • Jay Versluis 4:35 pm on July 24, 2015 Permalink | Reply
    Tags: CentOS,   

    Categories: Linux ( 95 )

    How to install Parallels Tools via the Command Line in CentOS 

    I like setting up barebones CentOS and other flavoured VMs on my Mac via Parallels Desktop. Trouble is, for such things like time synchronisation to work properly, something called Parallels Tools needs to be installed on each VM.

    This is to make sure Parallels Desktop can speak to the VM and communicate with it properly. It’s more important for GUIs so that the screen resolution and mouse handling is more accurate.

    Thing is, when you have a VM with a GUI, installing Parallels Tolls is extremely easy and may even happen automatically as soon as you install the OS. But if you have a command line only interface, it just doesn’t happen, and it’s up to us to install those tools manually. Here’s how to do it in CentOS 6.

    First, boot up your barebones VM and wait for it to start. Now head over to the VM’s menu and choose Actions – Install Parallels Tools. If they’re already installed, this message will change to “Reinstall Parallels Tools”.

    Screen_Shot_2015-07-21_at_16_39_13

    If your VM has a graphical user interface, this process will kick off the actual installation, but on barebones machines, it will merely attach the ISO image that contains the tools to your VM. In an ideal world, this tool would even mount the image for us, but sadly it doesn’t work with CentOS. Therefore we have a bit more work to do until we get to the installation part.

    You’ll see the following message to confirm the attachment:

    Screen-Shot-2015-07-21-at-16.29.35

    Now let’s login to our VM as root using our favourite SSH client (or simply use Parallels Desktop). We’ll create a directory to which we can mount the image. As suggested in the Parallels documentation, we’ll use /media/cdrom:

    mkdir /media/cdrom

    With this directory in place, let’s mount the ISO image to it so we can address it:

    mount -o exec /dev/cdrom /media/cdrom
    mount: block device /dev/sr0 is write-protected, mounting read-only

    The message is fairly self-explanatory: no writing to that ISO image. No problem! To start the installation, enter the directory and call the install script like so:

    cd /media/cdrom
    ./install

     

    Help! That’ didn’t work!

    Sometimes (in CentOS 7 for example) the ISO image isn’t properly mounted, and instead Parallels Desktop mounts a directory containing the ISO image. That’s no good of course. If you receive an error message along the lines of “command not found”, take a look at the CD Rom’s directory with the ls command.

    If there is no file called “install”, and instead there’s something like “prl-tools-lin.iso”, you need to manually attach the ISO image to your VM. To do this, restart your VM and select Devices – CD/DVD 1 – Connect Image. Now navigate to Applications – Parallels Desktop.app – Contents – Resources – Tools and pick the appropriate ISO file.

    Screen Shot 2015-08-07 at 12.49.50

     

    For all Linux flavours this is prl-tools-lin.iso. Once attached, mount the device as discussed above and you should be able to run the installer.

     

    Parallels Tools TUI in action

    The script will greet us with a TUI and some steps we need to complete, one of which may be that some additional components (such as make and gcc) need to be installed. That’s not always the case on barebones systems. Lucky for us, the script will take care of this for us too:

    Screen Shot 2015-07-21 at 16.33.51

    And that’s it! The script will finish fairly quickly, and at that point, Parallels Tools is installed in your VM. Congratulations! There’s only one final step: reboot the VM. You can either do that from the VM’s menu under Actions – Restart, or by issuing the following command:

    reboot now
    
    Broadcast message from root@yourserver
    (/dev/pts/0) at 16:53 ...
    
    The system is going down for reboot NOW!

    As soon as the VM is back up and running you’re all set 🙂

    Screen Shot 2015-07-21 at 16.38.48

     

    Further Reading:





     
  • Jay Versluis 4:28 pm on July 17, 2015 Permalink | Reply
    Tags: CentOS, ,   

    Categories: Plesk ( 70 )

    How to enable resuming FTP uploads in Plesk 

    Plesk uses ProFTP as the default FTP server. It has a handy feature that allows file uploads to resume or append should a connection be broken during transmission. This means that partially transferred data doesn’t have to be uploaded again, it can simply be added to – potentially saving a lot of time.

    Although easy to activate, this feature is not enabled by default on Plesk installations for security reasons. Here’s how to make it happen:

    Edit /etc/proftpd.conf and add the following few lines:

    # allow resuming file uploads
    AllowStoreRestart on
    AllowOverwrite on
    

    You may find the AllowOverwrite directive in there already, in which case replace it with the above block. For the changes to take effect, restart the xinetd service (of which proFTP is part):

    service xinetd restart
    

    Works on both CentOS 6 and CentOS 7.

    Note that for this to work, it also needs to be enabled in your FTP client. In FileZilla it’s under Settings – Transfers – File Exists Action:

    Screen-Shot-2015-04-09-at-12.40.26





     
  • Jay Versluis 9:55 am on May 3, 2015 Permalink | Reply
    Tags: CentOS   

    Categories: Linux, Plesk ( 95 )

    How to update Plesk via the Command Line 

    Plesk-LogoYou can update Plesk via the Web Interface (under Tools and Settings – Updates and Upgrades). However sometimes the interface times out, or browsers get confused – therefore it’s good to know that you can apply updates via the command line interface as well. In this article I’ll show you how (in Linux – I don’t know much about running Plesk on Windows I’m afraid).

    We need to download the standard installer script for this. It’s a powerful little tool which can also be used to add or remove components from the current Plesk installation, or to install Plesk on a barebones server.

    As of 2015 the link can be found here:

    Screen Shot 2015-05-03 at 09.39.40

    If you click the option “Download Plesk installer for Linux”, you’ll see the actual script open in a new browser tab. Not what we want, although you could copy and paste this into a new file on your Linux system. Instead, right-click on the link and choose “Copy Link” instead.

    Screen Shot 2015-05-03 at 09.41.27

    With that link in your clipboard, connect to your server via SSH and download the file with something like wget:

    wget http://autoinstall.plesk.com/plesk-installer?long-url-here
    

    This will result in a file called “plesk-installer” with some nasty parameters at the end, several hundred characters in total. Let’s rename it to something easier and tweak the execution permissions:

    mv plesk-installer* plesk-installer
    chmod +x plesk-installer
    

    Now we can run the script like so:

    ./plesk-installer
    
    Welcome to the Parallels Installation and Upgrade Wizard!
    ===============================================================================
    
    This wizard will guide you through the installation or upgrade process. Before
    installing or upgrading Parallels products, be sure to back up your data.
    
    To start the installation or upgrade, press N and then press Enter.
    To quit the installer, press Q and then press Enter.
    

    Follow the instructions to upgrade Plesk. You can also call the script with several options, for a full list of those call it with “–help”. To see all available versions of Plesk during the installation, use “–all-versions”, which will eventually lead you to a screen similar to this:

    Select the desired products and their versions
    ===============================================================================
    
    The following product versions are available:
    
    1. [*] Parallels Plesk
      2. ( ) Parallels Plesk Panel 12.1.21 (testing)
      3. ( ) Parallels Plesk Panel 12.1.20 (testing)
      4. ( ) Parallels Plesk Panel 12.1.19 (testing)
      5. ( ) Parallels Plesk Panel 12.1.18 (testing)
      6. ( ) Parallels Plesk Panel 12.1.17 (testing)
      7. ( ) Parallels Plesk Panel 12.1.16 (testing)
      8. ( ) Parallels Plesk Panel 12.1.15 (testing)
      9. ( ) Parallels Plesk Panel 12.1.14 (testing)
      10. ( ) Parallels Plesk Panel 12.1.13 (testing)
      11. ( ) Parallels Plesk Panel 12.1.12 (testing)
      12. ( ) Parallels Plesk Panel 12.1.11 (testing)
      13. ( ) Parallels Plesk Panel 12.1.10 (testing)
      14. ( ) Parallels Plesk Panel 12.1.9 (testing)
      15. ( ) Parallels Plesk Panel 12.1.8 (testing)
      16. ( ) Parallels Plesk Panel 12.1.7 (testing)
      17. ( ) Parallels Plesk Panel 12.1.6 (testing)
      18. (*) Parallels Plesk 12.0.18 (Stable) (currently installed)
    
    N) Go to the next page; P) Go to the previous page; Q) Cancel installing
    To select a version, type the respective number;
    Select an action [N]: 
    

    If you call the script without any parameters, only micro updates and additional components are applied. Micro updates are usually applied automatically if this feature is enabled (it is by default).





     
  • Jay Versluis 4:05 pm on April 23, 2015 Permalink | Reply
    Tags: CentOS, ,   

    Categories: Linux, Plesk ( 95 )

    How to open SMTP port 587 to send emails in Plesk 

    Plesk-LogoBy default Plesk on Linux uses Postfix for outgoing email, and by default listens on port 25 for outgoing SMTP mail. Some service providers do not allow to send emails on that port, and tragedy occurs: clients can’t send email with their Plesk servers. Not good.

    Other SMTP ports will usually work, such as the other favourite 587 – but by default, Postfix is not listening on this port for email submissions – at least not in Plesk 12.0.8 on CentOS 7.

    Here’s how to enable port 587 for such ventures:

    Open the Postfix configuration file at /etc/postfix/master.cf and find the following line. It’s commented out. All we have to do is to remove the hash in front of it, and email can be sent via port 587:

    submission inet n       -       n       -       -       smtpd
    

    Restart Postfix for the changes to take effect. In CentOS 5 and 6:

    service postfix restart
    

    This will also work in CentOS 7, but to be more precise:

    systemctl restart postfix.service
    

    Happiness!

    Note that port 587 needs to be open in your firewall. If the Plesk Firewall Extension is enabled, it’ll take care of it for you automagically.

     





     
    • Newman 8:06 am on December 29, 2016 Permalink | Reply

      Thank you for this!I am now able to send email from ec2 instance.

  • Jay Versluis 6:03 pm on April 22, 2015 Permalink | Reply
    Tags: CentOS   

    Categories: Linux, Plesk ( 95 )

    How to turn off all Plesk Health Monitor alert emails 

    Plesk-LogoI have previously described how to adjust the values that the Plesk Health Monitor uses to determine when an email should be sent out.

    There is also a way to switch these emails off entirely. Here’s how:

    To turn off the daemon that is responsible for sending these emails, issue this:

    /etc/init.d/psa-health-monitor-notificationd stop
    

    No more emails until you restart the server, when the daemon will be resumed. If you don’t want that, switch it off at boot time using

    chkconfig psa-health-monitor-notificationd off
    

    To remove the Health Monitor altogether, head over to Tools and Settings – Updates and Upgrades and uninstall the component.





     
  • Jay Versluis 8:24 am on April 21, 2015 Permalink | Reply
    Tags: , CentOS,   

    Categories: Plesk ( 70 )

    How to fix Apache/NGINX trouble after restarting your Plesk server 

    Plesk-LogoSome of my servers have a weird habit of throwing an Apache error after a restart: NGINX is running fine, but Apache can’t start and all websites are down. I have no idea why some servers do it and some do not. But when they do, it’s just plain annoying.

    Here are two ways to fix this problem.

    Restart Apache gracefully

    The quickest option is to shutdown NGINX, restart Apache, tell it to shutdown gracefully and then bring up NGINX again. Here are the commands that will work on CentOS 7:

    systemctl stop nginx.service
    systemctl restart httpd.service
    apachectl graceful
    systemctl restart nginx.service
    

    Likewise, on CentOS 6 we can use the service command to do the same:

    service nginx stop
    service httpd restart
    apachectl graceful
    service nginx restart
    

    Note that Apache doesn’t always like a restart – in which case, stop the service first, give it a moment and then restart it. Quirks and habits I guess.

    Thanks to Mike Yrabedra for this tip!

    If you find yourself doing this a lot, consider writing a quick script with the above commands, or restart your server less often (sometimes it’s enough to restart Plesk, or not reboot the machine at all). Alternatively, you can remove NGINX altogether and avoid such problems in the future.

    Removing NGINX from Plesk

    NGINX is not necessary – Apache will do a good job by itself. If you want to get rid of it completely, head over to Tools and Settings (or the Server Tab if you’re in Power User Mode) and select Updates and Upgrades. You’ll be taken to the Parallels Installer. Select Add/Remove Components.

    Screen Shot 2015-04-21 at 08.10.45

    Scroll down to the NGINX section under Web Hosting Features and untick both NGINX options. Now click Continue at the bottom and NGINX will be removed, leaving Apache in charge for all website connections. There’s no need to restart Plesk.

    Screen_Shot_2015-04-21_at_08_11_17

    Why would anyone want to use both NGINX and Apache together?

    Very good question indeed. Both are excellent web servers, and logic dictates that you should use one or the other. Using two web servers together is a certain sign of trouble.

    From what I understand, NGINX is not designed to be a replacement web server in Plesk (even though NGINX can be used in this way on a LAMP Stack). Instead it is implemented as an enhancement to Apache, sitting in front of it. Static files are therefore served from NGINX via Apache, and NGINX acts as a reverse proxy server.

    The benefits are faster connections and a smaller memory footprint. Read more about how NGINX and Apache are implemented in Plesk in the following articles:





     
    • Jay Versluis 10:18 pm on August 13, 2015 Permalink | Reply

      I’ve written a quick script that will work with CentOS 6 and CentOS 7 servers. Feel free to grab it from GitHub:

    • Jens 4:14 am on October 21, 2016 Permalink | Reply

      Awesome, it works! Thanks.

      • Jay Versluis 10:36 pm on October 21, 2016 Permalink | Reply

        Great to hear, Jens!

    • Dilip Kumar 12:36 pm on April 25, 2017 Permalink | Reply

      OMG… I thought there was error in the host, when the sites appear down after restart. Thanks buddy for helping, after restarting apache and nginx, sites are working now.

  • Jay Versluis 4:27 pm on April 9, 2015 Permalink | Reply
    Tags: CentOS,   

    Categories: Linux ( 95 )

    How to edit your network connection settings from the command line in CentOS 7 

    CentOS 7 has a very funky text-based user interface that allows editing several important network connection settings. It’s called nmtui.

    Type the command without any parameters to get started:

    nmtui

    Now use this handy interface:

    Screen Shot 2015-04-09 at 16.22.13

    Screen Shot 2015-04-09 at 16.22.59

    Screen Shot 2015-04-09 at 16.22.33

    Your system may require a full restart for all settings to take affect.





     
  • Jay Versluis 4:39 pm on April 6, 2015 Permalink | Reply
    Tags: CentOS   

    Categories: Plesk ( 70 )

    How to move the vhosts directory in Plesk 

    Plesk-LogoThe default directory for all web files in Plesk on Linux is /var/www/vhosts. Usually this works well, but if you’d like to use another partition instead, you’ll be pleased to hear that you can!

    Parallels (or Odin as we call them now) have written a handy script which moves the content and patches the relevant configuration file and copies all content at the same time. The script is called transvhosts and you can download it here:

    Download it using wget and make the file executable:

    wget http://kb.sp.parallels.com/Attachments/kcs-12467/transvhosts.pl
    chmod +x transvhosts.pl
    

    It’s a PERL script, which means it needs prefixed with ‘perl’ to be called. Say you want to move your vhosts directory to /home/vhosts, you’d call it like this:

    perl transvhosts.pl --dest-dir /home/vhosts --correct-scripts
    
    Moving files to new directory...
    Correct psa configuration file...
    Correct passwd file...
    Correct server configuration files...
    Clean up symlinks...
    /etc/httpd/conf/plesk.conf.d/vhosts
    Correct php-fpm pools configuration...
    Moving files to new directory...
    Correct psa configuration file...
    Correct passwd file...
    Correct server configuration files...
    Clean up symlinks...
    /etc/httpd/conf/plesk.conf.d/vhosts
    Correct database...
    Update hosting settings...
    done
    Update subdomains settings...
    done
    Update system users settings...
    done
    The service node 'local' was successfully updated.
    Correct user scripts...
    

    This may take a moment or two depending on the amount of content you have in the current directory. The script will patch Plesk’s configuration file and restart the panel. There’s minimal downtime in involved in this process.





     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel