Passwordless sudo

 

The Nutanix Calm product is great for automating the deployment of applications stacks. So I’ve been learning Calm by attempting to deploy some LEMP stacks and other application on Ubuntu Images. However I was stuck at trying to issue scripts which needed sudo elevation, being prompted for a secondary password is a pig when trying to script anything.

The quick answer to this is to make sudo passwordless.

You do this by creating a file inĀ /etc/sudoers.d/ (I called mine passwordless) and adding a line …

Replacing <username> with the user you wish to apply the passwordless sudo to.

That’s it, no more being prompted for sudo passwords.

How to use sed to delete a line that contains text and not leave a carriage return behind

Use the following command to remove a line from a text file that matches your variable.

sed "/text/d" file.txt

Obviously replace text with your text match string and file with your filename.

Install cURL on Ubuntu Linux

If you use PHP, you may need to use cURL, which is one of the most popular extension. PHP CURL functions are available through the use of libcurl, a library created by Daniel Stenberg, and allow you to connect and communicate with web servers using many
different types of protocols.

Assuming you have already setup LAMP. To install or setup cURL on your Linux machine like Ubuntu, run the following line of shell command in your terminal:

sudo apt-get install curl php5-curl libcurl3 libcurl3-dev

Now you have PHP cURL installed, the next thing you need to do is to restart apache2, run the following command in your terminal:

sudo /etc/init.d/apache2 restart