Sudo Systemctl For Macos

Introduction

Sudo apt-get update && sudo apt-get install influxdb sudo systemctl unmask influxdb.service sudo systemctl start influxdb. For instructions on how to install the RPM package from a file. Users of macOS 10.8 and higher can install InfluxDB using the Homebrew package. May 11, 2020  sudo./airprint-generate.py -d /etc/avahi/services/ Now there should a.service file under /etc/avahi/services/ directory for your printer. Ls /etc/avahi/services/ Sample output: AirPrint-DeskJet-2130-series.service. Restart Avahi-daemon. Sudo systemctl restart avahi-daemon. Now iOS and macOS clients in the same network should be able to use.

To have a full Raspberry Pi experience, you should use Raspbian, the OS developed exclusively for Raspberry Pi. Raspbian is a Debian-based system optimized to utilize Raspberry Pi hardware most efficiently. If you want to transfer data or administer the device remotely via SSH, you need to enable SSH first.

Follow the steps in this guide to learn how to enable SSH on Raspberry Pi without a screen, from the GUI, or using the raspi-config file. We will also show you how to find the IP address of your Raspberry Pi and how to SSH into the device.

  • Raspberry Pi with Raspbian installed
  • Access to a computer with a microSD or SD card reader (for pre-2014 Raspberry Pi versions)
  • Necessary admin permissions to perform the tasks
  • Access to an SSH client: PuTTy in Windows or Terminal in Linux/macOS

If you installed any of the Raspbian versions from late 2016 onwards, then SSH is disabled by default. The reason behind this decision was to improve security. Since all Raspbian images come with a user “pi” and the default password “raspberry,” it was easy for hackers to use this in their favor.

However, you can easily enable SSH on Raspberry Pi even if you do not have a monitor and keyboard connected. We will explain three possible ways to enable SSH on Raspbian. Read through the guide and choose the method that you prefer.

Many users run these devices as a web or media server and configure them via SSH. If you use your Raspberry Pi without a monitor and keyboard, then the only way to enable SSH in headless mode is to use a blank boot file.

For this task, you need to create an empty ssh file on another machine. We will use this file on the Raspbian boot SD card to enable SSH. If you do not feel like creating the file yourself, we made the blank ssh boot file available for download.

To enable SSH on Raspberry Pi in headless mode, follow these steps:

1. Make sure you properly installed Raspbian on your Raspberry Pi microSD card. If you have already done so, turn off the device and remove the card.

2. Put the microSD card in the card reader of your computer. Wait until the card mounts. You may need to use a microSD to SD card adapter. All recent Raspberry Pi versions use microSD instead of standard-size SD cards.

3. Navigate to the boot folder. This is the root folder of your SD card. Bootis the default volume name when you install a Raspbian system on an SD card. If you are on a Windows machine, use any file manager, such as Explorer. On macOS or Linux, open a terminal window and type:

Note that the name of your SD card can be something other than “boot”. If it is, open the root volume folder and proceed with the next steps.

Sudo Systemctl For Macos Mac

4. In the boot volume, create a file without an extension and name it ssh.

    • On Windows,right-click anywhere in the boot volume’s white space and select New > Text Document. Delete the .txt extension before you hit Enter. If Windows Explorer on your computer does not show file extensions, click View and enable File name extensions in the menu bar.
    • On Mac or Linux, run the touchcommand while in the boot directory to create a blank ssh file:

5. Safely removeor eject thecard from the computer and insert it again in your Raspberry Pi.

6. Boot up Raspberry Pi.

Every time you turn on the Pi board, the device looks for the ssh file. When the device finds the file, then SSH is enabled automatically. If you correctly created an empty ssh file without an extension, you can now SSH into your device.

Enable SSH on Raspberry Pi using GUI Configuration Options

Things get much faster and easier when you have a monitor and peripherals connected to your Raspberry Pi. If you are used to configuring your device using a GUI, follow the steps below.

Once your device boots up:

1. Click the raspberry logo at the top-left corner.

2. Select Preferences > Raspberry Pi Configuration.

3. Navigate to the Interfaces tab in the configuration window.

4. Enable SSH in the second line.

5. Click OK to save the changes.

That’s it. Your Raspberry Pi is now accessible via SSH. Make sure the device is connected to the internet before trying to establish an SSH session.

If you are used to configuring your system from the terminal, you can choose one of the two options below.

To enable SSH using the raspi-config tool:

1. Open the terminal on your Raspberry Pi and run the tool by typing:

A BIOS-looking raspi-config tool loads.

2. Use the arrows on your keyboard to select Interfacing Options.

3. Select the P2SSH option on the list.

4. Select <Yes> on the “Would you like the SSH server to be enabled?” prompt.

5. Hit Enter on the “The SSH server is enabled” confirmation box.

6. Navigate down and select Finish to close the raspi-config.

You can close the terminal window. Your device is now ready to accept SSH connections.

The final option to enable SSH on Raspberry Pi is to start the systemctlservice from your terminal.

To do so, load the terminal and run these two commands:

The ssh service is now both enabled and started.

Now that you enabled SSH on your Raspberry Pi, you can use SSH to connect from another machine.

Before we can continue, you need to find the IP address of your device. While you are logged in the Raspbian system, open the terminal and run this command:

Sudo systemctl enable docker

Alternatively, you can run theifconfig or ip a command to find the IP address. We prefer using the hostname command as it only displays the address without other network information.

Use the Terminal in macOS or Linux to Connect to Raspberry Pi

Using SSH to remotely manage a Raspberry Pi device is the same as managing any other Linux-based machine. Both macOS and Linux have SSH clients by default.

To connect via SSH to your Raspberry Pi from the terminal, use this command:

Note: Pi is the default user account. If you use another account name, type it in instead of Pi. Use your device's IP address identified in the previous step.

The first time you connect to your Raspberry Pi, you will get a prompt to accept the RSA key. Type yes, and the new SSH session starts.

Windows users can SSH into Raspberry Pi using PuTTY.

Start the tool and enter the IP address of your device. Make sure SSH is selected, and the port set to 22.

Click Open to start a new session. Enter your Raspberry Pi’s account username and password.

In November 2016, SSH was disabled by default on Raspbian. This move was made to prevent Raspberry Pi devices from potentially becoming a part of an IoT botnet.

Now that you have decided to use SSH to connect to your Raspberry Pi, we advise you to change the default account password.

Since all Raspbian installations come with a default account and password, it is easy for hackers to log into your device. To make your device less vulnerable, change Raspberry Pi’s default password.

1. To do so, run the raspi-config tool from the terminal on your device:

2. Select the Change User Password option.

Follow the instructions to change the password. Your Raspberry Pi is now ready and more secure for SSH access. We recommend you take further steps to improve SSH security.

Now you know how to enable SSH on Raspberry Pi. This tutorial has shown you how to enable the service even if you do not have a monitor and keyboard connected to your Raspberry Pi. If you have the peripherals connected, then you can choose the method that suits you best.

Make sure you take a few basic steps to secure your device. If you need a reminder on the most common SSH commands, refer to our Linux SSH commands guide.

Next you should also read

This article guides you through the Java installation process on Raspberry Pi. You will also learn how to set…

This guide lists all the steps necessary to install Ubuntu MATE on your Raspberry Pi. This includes…

Systemctl

Update your Raspberry Pi to keep it secure. In this guide you can also learn how to upgrade from an old to…

Rsync is a Linux tool that allows you to transfer data over SSH to a remote server securely. Use the options…

The article covers the 5 most common and efficient ways to secure an SSH connection. The listed solutions go…

Secure Shell is an important protocol for anyone managing and controlling remote machines. This guide covers…

-->

The following instructions assume a clean environment and show how to install PHP 7.x, the Microsoft ODBC driver, the Apache web server, and the Microsoft Drivers for PHP for SQL Server on Ubuntu 16.04, 18.04, and 19.10, RedHat 7 and 8, Debian 8, 9, and 10, Suse 12 and 15, Alpine 3.11, and macOS 10.13, 10.14, and 10.15. These instructions advise installing the drivers using PECL, but you can also download the prebuilt binaries from the Microsoft Drivers for PHP for SQL Server GitHub project page and install them following the instructions in Loading the Microsoft Drivers for PHP for SQL Server. For an explanation of extension loading and why we do not add the extensions to php.ini, see the section on loading the drivers.

These instructions install PHP 7.4 by default using pecl install. You may need to run pecl channel-update pecl.php.net first. Note that some supported Linux distros default to PHP 7.1 or earlier, which is not supported for the latest version of the PHP drivers for SQL Server -- please see the notes at the beginning of each section to install PHP 7.2 or 7.3 instead.

Also included are instructions for installing the PHP FastCGI Process Manager, PHP-FPM, on Ubuntu. This is needed if using the nginx web server instead of Apache.

Contents of this page:

Installing the drivers on Ubuntu 16.04, 18.04, and 19.10

Note

To install PHP 7.2 or 7.3, replace 7.4 with 7.2 or 7.3 in the following commands.

Step 1. Install PHP

Step 2. Install prerequisites

Install the ODBC driver for Ubuntu by following the instructions on the Linux installation article.

Step 3. Install the PHP drivers for Microsoft SQL Server

If there is only one PHP version in the system, then the last step can be simplified to phpenmod sqlsrv pdo_sqlsrv.

Step 4. Install Apache and configure driver loading

Step 5. Restart Apache and test the sample script

To test your installation, see Testing your installation at the end of this document.

Installing the drivers with PHP-FPM on Ubuntu

Note

To install PHP 7.2 or 7.3, replace 7.4 with 7.2 or 7.3 in the following commands.

Step 1. Install PHP

Verify the status of the PHP-FPM service by running

Step 2. Install prerequisites

Install the ODBC driver for Ubuntu by following the instructions on the Linux installation article.

Step 3. Install the PHP drivers for Microsoft SQL Server

If there is only one PHP version in the system, then the last step can be simplified to phpenmod sqlsrv pdo_sqlsrv.

Verify that sqlsrv.ini and pdo_sqlsrv.ini are located in /etc/php/7.4/fpm/conf.d/:

Restart the PHP-FPM service:

Step 4. Install and configure nginx

To configure nginx, you must edit the /etc/nginx/sites-available/default file. Add index.php to the list below the section that says # Add index.php to the list if you are using PHP:

Next, modify the section following # pass PHP scripts to FastCGI server as follows:

Step 5. Restart nginx and test the sample script

Systemctl For Mac

To test your installation, see Testing your installation at the end of this document.

Installing the drivers on Red Hat 7 and 8

Step 1. Install PHP

To install PHP on Red Hat 7, run the following:

Note

To install PHP 7.2 or 7.3, replace remi-php74 with remi-php72 or remi-php73 respectively in the following commands.

To install PHP on Red Hat 8, run the following:

Note

To install PHP 7.2 or 7.3, replace remi-7.4 with remi-7.2 or remi-7.3 respectively in the following commands.

Step 2. Install prerequisites

Install the ODBC driver for Red Hat 7 or 8 by following the instructions on the Linux installation article.

Step 3. Install the PHP drivers for Microsoft SQL Server

You can alternatively install from the Remi repo:

Step 4. Install Apache

SELinux is installed by default and runs in Enforcing mode. To allow Apache to connect to databases through SELinux, run the following command:

Step 5. Restart Apache and test the sample script

To test your installation, see Testing your installation at the end of this document.

Installing the drivers on Debian 8, 9, and 10

Note

To install PHP 7.2 or 7.3, replace 7.4 in the following commands with 7.2 or 7.3.

Step 1. Install PHP

Step 2. Install prerequisites

Install the ODBC driver for Debian by following the instructions on the Linux installation article.

You may also need to generate the correct locale to get PHP output to display correctly in a browser. For example, for the en_US UTF-8 locale, run the following commands:

You may need to add /usr/sbin to your $PATH, as the locale-gen executable is located there.

Step 3. Install the PHP drivers for Microsoft SQL Server

If there is only one PHP version in the system, then the last step can be simplified to phpenmod sqlsrv pdo_sqlsrv. As with locale-gen, phpenmod is located in /usr/sbin so you may need to add this directory to your $PATH.

Step 4. Install Apache and configure driver loading

Step 5. Restart Apache and test the sample script

To test your installation, see Testing your installation at the end of this document.

Installing the drivers on Suse 12 and 15

Note

In the following instructions, replace <SuseVersion> with your version of Suse - if you are using Suse Enterprise Linux 15, it will be SLE_15 or SLE_15_SP1. For Suse 12, use SLE_12_SP4 (or above if applicable). Not all versions of PHP are available for all versions of Suse Linux - please refer to http://download.opensuse.org/repositories/devel:/languages:/php to see which versions of Suse have the default version PHP available, or to http://download.opensuse.org/repositories/devel:/languages:/php:/ to see which other versions of PHP are available for which versions of Suse.

Note

Packages for PHP 7.4 are not available for Suse 12.To install PHP 7.2, replace the repository URL below with the following URL:https://download.opensuse.org/repositories/devel:/languages:/php:/php72/<SuseVersion>/devel:languages:php:php72.repo.To install PHP 7.3, replace the repository URL below with the following URL:https://download.opensuse.org/repositories/devel:/languages:/php:/php73/<SuseVersion>/devel:languages:php:php73.repo.

Step 1. Install PHP

Step 2. Install prerequisites

Install the ODBC driver for Suse by following the instructions on the Linux installation article.

Step 3. Install the PHP drivers for Microsoft SQL Server

Note

If you get an error message saying Connection to 'pecl.php.net:443' failed: Unable to find the socket transport 'ssl', edit the pecl script at /usr/bin/pecl and remove the -n switch in the last line. This switch prevents PECL from loading ini files when PHP is called, which prevents the OpenSSL extension from loading.

Sudo Systemctl Stop Docker

Step 4. Install Apache and configure driver loading

Step 5. Restart Apache and test the sample script

To test your installation, see Testing your installation at the end of this document.

Installing the drivers on Alpine 3.11

Sudo Systemctl For Macos Windows 7

Note

The default version of PHP is 7.3. Alternate versions of PHP may be available from other repositories for Alpine 3.11. You can instead compile PHP from source.

Step 1. Install PHP

PHP packages for Alpine can be found in the edge/community repository. Please check Enable Community Repository on their WIKI page. Add the following line to /etc/apt/repositories, replacing <mirror> with the URL of an Alpine repository mirror:

Then run:

Step 2. Install prerequisites

Install the ODBC driver for Alpine by following the instructions on the Linux installation article.

Step 3. Install the PHP drivers for Microsoft SQL Server

Step 4. Install Apache and configure driver loading

Step 5. Restart Apache and test the sample script

To test your installation, see Testing your installation at the end of this document.

Installing the drivers on macOS High Sierra, Mojave, and Catalina

If you do not already have it, install brew as follows:

Note

To install PHP 7.2 or 7.3, replace php@7.4 with php@7.2 or php@7.3 respectively in the following commands.

Step 1. Install PHP

PHP should now be in your path -- run php -v to verify that you are running the correct version of PHP. If PHP is not in your path or it is not the correct version, run the following:

Step 2. Install prerequisites

Install the ODBC driver for macOS by following the instructions on the macOS installation article.

In addition, you may need to install the GNU make tools:

Step 3. Install the PHP drivers for Microsoft SQL Server

Step 4. Install Apache and configure driver loading

To find the Apache configuration file, httpd.conf, for your Apache installation, run

The following commands append the required configuration to httpd.conf. Be sure to substitute the path returned by the preceding command in place of /usr/local/etc/httpd/httpd.conf:

Step 5. Restart Apache and test the sample script

To test your installation, see Testing your installation at the end of this document.

Testing Your Installation

To test this sample script, create a file called testsql.php in your system's document root. This is /var/www/html/ on Ubuntu, Debian, and Redhat, /srv/www/htdocs on SUSE, /var/www/localhost/htdocs on Alpine, or /usr/local/var/www on macOS. Copy the following script to it, replacing the server, database, username, and password as appropriate.

Point your browser to https://localhost/testsql.php (https://localhost:8080/testsql.php on macOS). You should now be able to connect to your SQL Server/Azure SQL database.

See Also