{"id":86160,"date":"2020-01-21T14:36:50","date_gmt":"2020-01-21T14:36:50","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=86160"},"modified":"2021-04-27T13:35:11","modified_gmt":"2021-04-27T13:35:11","slug":"how-to-create-an-ubuntu-powershell-development-environment-part-1","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/devops\/database-devops\/how-to-create-an-ubuntu-powershell-development-environment-part-1\/","title":{"rendered":"How to Create an Ubuntu PowerShell Development Environment \u2013 Part 1"},"content":{"rendered":"<p><strong>The series so far:<\/strong><\/p>\n<ol>\n<li><a href=\"https:\/\/www.red-gate.com\/simple-talk\/sql\/database-devops-sql\/how-to-create-an-ubuntu-powershell-development-environment-part-1\/\">How to Create an Ubuntu PowerShell Development Environment \u2013 Part 1<\/a><\/li>\n<li><a href=\"https:\/\/www.red-gate.com\/simple-talk\/sql\/sql-linux\/how-to-create-an-ubuntu-powershell-development-environment-part-2\/\">How to Create an Ubuntu PowerShell Development Environment \u2013 Part 2<\/a><\/li>\n<li><a href=\"https:\/\/www.red-gate.com\/simple-talk\/sql\/sql-linux\/how-to-create-an-ubuntu-powershell-development-environment-part-3\/\">How to Create an Ubuntu PowerShell Development Environment \u2013 Part 3<\/a><\/li>\n<\/ol>\n\n<p>Microsoft has made great effort over the last few years toward multi-platform compatibility. A large part of the IT world runs on Linux. Microsoft recognizes this and has been deploying a lot of their software to now run on the Linux platform. Visual Studio Code, PowerShell, even SQL Server can now run on Linux. As such, it can be beneficial to create your own Linux development environment on your desktop, whether for doing work or just for learning.<\/p>\n<p>While it would be nice to have a computer to install Linux and our other tools directly on, often referred to as a \u201cbare metal\u201d install, most people don\u2019t have extra computers laying around. The solution to this is the use of a <strong>virtual machine<\/strong>. In this article, part 1 of 2, I\u2019ll show you how to setup a virtual machine, often referred to as a VM.<\/p>\n<p>Into that VM, you\u2019ll install a Linux distribution, often referred to as a \u201cdistro\u201d in the Linux community. It\u2019s important to understand that Linux is the core of the operating system, often called the kernel. Around this kernel people have developed many server and desktop environments. This article will demonstrate use of the most popular ones, Ubuntu, specifically the 19.10 version.<\/p>\n<p>Part 2 of this series will demonstrate how to install PowerShell, Visual Studio Code, and other tools into the Ubuntu VM.<\/p>\n<p>This will create a foundation for a future article, in which you\u2019ll see how to install Docker, then SQL Server into the VM. You\u2019ll then see how to use PowerShell to work with SQL Server as it runs in the Docker container.<\/p>\n<h1>VirtualBox<\/h1>\n<p>The first thing you need is <strong>virtualization software<\/strong>, this is the software that will host and run the virtual machine. Hyper-V is one choice, and if you have it and are comfortable with it, you are welcome to use it for this project.<\/p>\n<p>Hyper-V does require you to have Windows 10 Pro. Many people, especially those at home, may not have the Pro version. For this article then I will be using <strong>VirtualBox<\/strong>.<\/p>\n<p>VirtualBox is free, and easy to use. It is also multi-platform, it will run on Windows, Linux, macOS, and Solaris. This article will cover running it on Windows. Do be aware you cannot run VirtualBox and Hyper-V on the same machine, as they both need exclusive access to the same system resources.<\/p>\n<p>You can obtain VirtualBox by going to their website, <a href=\"https:\/\/www.virtualbox.org\/\">https:\/\/www.virtualbox.org\/<\/a> and downloading it. Installation is extremely simple, there are almost no options. You can take the defaults for an easy install.<\/p>\n<h1>Ubuntu 19.10<\/h1>\n<p>After getting VirtualBox installed, you will need a copy of the Ubuntu 19.10 ISO image. The <strong>ISO<\/strong> is a file that can be used to install operating systems. ISOs can be written to a USB key or DVD and used to boot a computer, or in this case as a source for VirtualBox.<\/p>\n<p>Getting the ISO is easy, just go to <a href=\"https:\/\/ubuntu.com\/\">https:\/\/ubuntu.com\/<\/a> . On the front page in the title bar is a <strong>Download<\/strong> link. Clicking on it will take you to the downloads page for 19.10, where you will want to download the <em>desktop<\/em> version of Ubuntu.<\/p>\n<p>From the downloads, simply save the ISO file to your hard drive. Note if you want to experiment with other versions of Ubuntu, simply go to the Downloads link in the upper right and you\u2019ll find other versions you can experiment with.<\/p>\n<h1>Creating the Ubuntu Virtual Machine<\/h1>\n<p>Now you\u2019re ready to take the first step and create the virtual machine. Open VirtualBox, and you\u2019ll see the following screen. In this shot, on the left you will note a list of VMs that I have from other projects, your area will be empty initially but will soon be populated with your own virtual machines.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"916\" height=\"697\" class=\"wp-image-86161\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-90.png\" \/><\/p>\n<h2>Setting the VM Name and Type<\/h2>\n<p>Start by clicking the big <em>New <\/em>button in the toolbar to begin the process of creating our VM. When you do, the following dialog in appears. Click <em>Expert Mode<\/em> to see all the options instead of a wizard.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"500\" class=\"wp-image-86162\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-91.png\" \/><\/p>\n<p>Here you can see I\u2019ve filled out the basic information needed to create the VM. First, I gave it a good name. I took the default for the <em>Machine Folder<\/em>, that is the path where the virtual machine information will be stored. Note this is for the VM metadata but does not include the location of the virtual hard drive, which will be set in a moment.<\/p>\n<p>I\u2019ve made sure to set the <em>Type<\/em> to Linux, and the version to Ubuntu (64 bit). The next setting, <em>Memory size<\/em>, will be somewhat dependent on the computer you are using. Typically for this type of application you want at least 4 gigabytes, or 4096 megabytes, which is what I have set here.<\/p>\n<p>Finally, make sure the <em>Create a virtual hard disk now<\/em> is selected the click the <em>Create<\/em> button.<\/p>\n<h2>VM Hard Disk Options<\/h2>\n<p>On the next screen you are presented with options about the virtual hard drive that will be created. Here is the screen all filled out.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"463\" class=\"wp-image-86163\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-92.png\" \/><\/p>\n<p>You can store the virtual hard drive in a different location than the rest of the VM\u2019s data. The <em>File location<\/em> box is used to indicate that location. A helpful hint, often you can get a performance boost by storing your virtual hard drives on a different physical hard drive than the one of the <em><strong>host operating<\/strong><\/em> system. Commonly, the operating system running on the computer itself is referred to as the host operating system. Any virtual machines are known as the <em><strong>guest<\/strong><\/em> operating system.<\/p>\n<p>Next up is the <em>File size<\/em>. Because you will be working with SQL Server, you may need extra space, so initially I recommend setting this to 20 GB. You can do so by using the slider bar, or simply typing into the box to the left of the slider.<\/p>\n<p>On the lower left is the file type, and there are multiple choices. <em>VDI<\/em> is the native type for VirtualBox, and what will be used for this article. However, VirtualBox also supports types may other types from other virtualization software. VHD is the format for Hyper-V, VMDK for VMWare, and so on. Typically, you would not create a full OS drive in another file type, however this capability may be used later to attach files from other virtualization software to read their data.<\/p>\n<p>Finally, on the lower right, you\u2019ll see the <em>Storage on physical hard disk<\/em> options. With the <em>Dynamically allocated<\/em> option, VirtualBox will only take as much space as it needs for the drive, up to the maximum indicated in the file size area (in this case, 20 GB). The second option, <em>Fixed size<\/em>, will create the virtual disk at its maximum size of 20 GB. Fixed size can perform a bit better as it does not need to worry about checking for disk size and expanding on the fly, it also takes up disk space that may not be needed much of the time. For this article go with the dynamic option and click <em>Create<\/em>.<\/p>\n<h2>Setting Additional VM Options<\/h2>\n<p>When you create the VM, it now appears in the list on the left. On the right are the machine options.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"916\" height=\"697\" class=\"wp-image-86164\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-93.png\" \/><\/p>\n<h3>General Settings<\/h3>\n<p>Before you can launch your new VM, there are some settings you need to update. Do note though, if you go into the settings of a running VM many options will be disabled, and this holds true regardless of what virtualization software you are using. You can change the majority of settings only when the VM is shutdown. You won\u2019t have that issue quite yet as you haven\u2019t installed Ubuntu in the VM yet, but it\u2019s something to be aware of for your future use.<\/p>\n<p>Start by clicking on the gold <em>Settings<\/em> gear icon in the toolbar. As you can see, the dialog that appears allows you to change many options.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" class=\"wp-image-86165\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-94.png\" \/><\/p>\n<p>While still on the <em>General<\/em> settings page, click on the <em>Advanced<\/em> tab.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" class=\"wp-image-86166\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-95.png\" \/><\/p>\n<p>On this tab, change the <em>Shared Clipboard<\/em> and <em>Drag\u2019n\u2019Drop<\/em> to <em>Bidirectional<\/em>, as you see above. This will allow you to cut and paste to and from the virtual machine. Likewise, you can copy files into the VM using drag and drop. This is entirely optional, of course, but will make it much easier to work with the VM. Do note that if you are doing security testing of some type, you will wish to alter these settings to either <em>Disabled<\/em>, or just allow pasting into the VM by picking <em>Host to Guest<\/em>. However, this is a simple development box so having bidirectional copy\/paste will be fine.<\/p>\n<h3>System Settings<\/h3>\n<p>Next, click on the <em>System<\/em> page on the left to bring up the system settings.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" class=\"wp-image-86167\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-96.png\" \/><\/p>\n<p>The first tab is the <em>Motherboard<\/em>; it is on this page where you can change the amount of ram for example. Don\u2019t change anything on this tab, but it very useful to know where to come should you later decide you need to change the amount of ram or any of the other motherboard settings. Take a look at the <em>Processor<\/em> tab next.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" class=\"wp-image-86168\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-97.png\" \/><\/p>\n<p>By default, VirtualBox set up this VM with 1 CPU. The computer I\u2019m writing this on has 4 CPUs, so I have opted to increase the CPU count to 2, as you see in the above image. Ultimately this is something you\u2019ll have to determine based on the physical characteristics of your host computer, as well as the demands you\u2019ll be placing on the VM. In my case, I only plan to run one VM at a time, and I won\u2019t be using many resources in the host computer while I am working in the virtual machine.<\/p>\n<p>Now it\u2019s time to move on; click on the <em>Display<\/em> option on the left.<\/p>\n<h3>Display Settings<\/h3>\n<p>There are a few changes on the <em>Screen<\/em> tab you should make here to increase performance.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"529\" class=\"wp-image-86169\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-98.png\" \/><\/p>\n<p>First is the <em>Video Memory<\/em>. By default, it is at 16MB. I suggest maxing it out to the full 128MB. If you discover later this provides too negative of an impact to your system you can always adjust it to a lower value.<\/p>\n<p>I want to call your attention to the next item, <em>Monitor Count<\/em>. VirtualBox will let you create multiple virtual monitors, a very helpful utility when you have multiple physical monitors on your host computer. When I first setup a new virtual machine, I always leave this to 1, as you see here. Once I have the VM up and running, I can return here later and add monitors if needed. For example, at home with my laptop hooked to its docking station, I will open the settings and adjust this to 3. Later, when I take my laptop out of the house, I will adjust this back down to 1.<\/p>\n<p><em>Scaling Factor<\/em> works just like it does in Windows, it will magnify certain graphical elements in the guest operating system while leaving the resolution alone. I typically leave this set to the default.<\/p>\n<p>The last item of note is the <em>Graphics Controller<\/em>. We suggest you set to <strong>VMSVGA<\/strong>. This setting should allow you to resize the window of your VM, and the VM will then adjust its resolution to fit that of the resized window. However, not all graphics cards respond the same, so you may need to return later and try some of the other settings. Once a virtual machine is created, you can easily go back later and edit things like the graphics controller.<\/p>\n<p>Also be aware some guest operating systems may not support this feature, although the Ubuntu 19.10 used in this article does.<\/p>\n<p>There is one last thing to update, and it is the most important to getting our VM up and running. Click on the Storage icon on the left.<\/p>\n<h3>Storage Settings<\/h3>\n<p>In order to install the Ubuntu, you need to insert the Ubuntu ISO image into the VM\u2019s virtual CD\/DVD drive. It is in this step you will accomplish this.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"901\" height=\"540\" class=\"wp-image-86170\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-99.png\" \/><\/p>\n<p>Start by clicking on the <em>Empty<\/em> label, pointed to by number 1 in the above image.<\/p>\n<p>To the right of the Optical Drive is an icon of a DVD (pointed at by number 2). Click on it to expand the menu.<\/p>\n<p>Now click on <em>Choose a disk file\u2026<\/em>, indicated by number 3 in the above graphic. Note that if you have installed other VMs in the past, the most recent three ISOs used will appear in the menu. If one of these is the operating system you want to install, you can simply pick it. In this case, navigate to the ISO you downloaded from the Ubuntu site.<\/p>\n<h3>Other Settings<\/h3>\n<p>There are no more modifications to make in order to proceed. You are free of course to explore the other setting pages. I do want to call your attention to the <em>Shared Folders<\/em> page. With Shared Folders, you designate a folder location in your host operating system. That folder will then appear inside the file manager inside your guest operating system. This makes it very easy to copy files in and out of your virtual machine.<\/p>\n<p>Just click the big <em>OK<\/em> button to save your configuration settings and proceed to the next step.<\/p>\n<h1>Installing Ubuntu 19.04<\/h1>\n<p>Now that you have the machine configured it\u2019s time to get started installing Ubuntu. Make sure the new <em>Ubuntu 19.10 Dev<\/em> VM is selected in the list of VMs on the left, then click the green <em>Start<\/em> arrow in the toolbar above the VM settings.<\/p>\n<p>If you forgot to attach the ISO in the previous step, when the machine launches, VirtualBox detects there is no operating system installed. Here it is prompting you for the ISO image to use. <img loading=\"lazy\" decoding=\"async\" width=\"642\" height=\"554\" class=\"wp-image-86171\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-100.png\" \/><\/p>\n<p>If you remembered to connect it, you\u2019ll skip the above screen. It\u2019s a common mistake to miss attaching the ISO so we wanted to make sure to mention it.<\/p>\n<p>Because you had loaded the Ubuntu ISO in the Storage settings in the previous section, it defaults to it. Just click <em>Start<\/em> to run the machine with this ISO.<\/p>\n<p>If you are running on a slower machine, you may see the following dialog.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"479\" height=\"139\" class=\"wp-image-86172\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-101.png\" \/><\/p>\n<p>At this point VirtualBox has begun the processes of setting up the VM. Just sit back and wait. The amount of time it will take depends on your computer, so be patient. If you computer is fast enough, you may not see the above dialog box at all.<\/p>\n<p>You will soon see a new window open, with the Ubuntu Virtual Machine. It will take it a little time to spin up, don\u2019t be surprised if you see a blank screen for a little bit. Eventually you will see the Ubuntu installer appear.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86173\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-102.png\" \/><\/p>\n<p>Here you have two choices, <em>Try Ubuntu<\/em> or <em>Install Ubutnu<\/em>. Ubuntu is distributed as a <strong>Live DVD<\/strong>. In Live mode, you could use a tool to create a bootable USB stick, then boot your physical computer to the USB stick instead of your hard drive. Using the Try option would let you experiment with Ubuntu without making changes to your computer. (If you decide you want to try this for yourself, I recommend the balenaEtcher tool, available at <a href=\"https:\/\/www.balena.io\/etcher\/\">https:\/\/www.balena.io\/etcher\/<\/a> ).<\/p>\n<p>In this case you are installing in a virtual machine, with no risk to the host operating system, so after verifying the correct language is selected on the left, click the <em>Install Ubuntu<\/em> option.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86174\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-103.png\" \/><\/p>\n<p>The first thing you are asked is to confirm your keyboard layout. Ubuntu does a good job of figuring it out and picking it automatically, but if you would like to pick something different this is the time to change it. If you are happy, then just click the <em>Continue<\/em> button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86175\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-104.png\" \/><\/p>\n<p>In the next screen, you are given some options. First, it wants to know if you want a normal install or minimal. With minimal, only the web browser and a few basic tools are installed. In normal mode, it will also install office software, media players, and more. I suggest using the <em>Normal Installation<\/em> option, as it\u2019s often useful to have some of the office tools in your VM. Don\u2019t worry though, if you go with a minimal install, you can easily install other things from the Ubuntu software store that is built into the Ubuntu operating system.<\/p>\n<p>Under the other options, the <em>Download updates\u2026<\/em> is checked on by default. While you can install updates after installation, it makes it easy to just go ahead and download them now. It will add a bit of time to the setup operation, but if you have a decent internet connection this will be minimal.<\/p>\n<p>The last option, <em>Install third-party software\u2026<\/em> is unchecked by default. Some Linux users are \u201cpurists\u201d and will only use open source software. Others are more pragmatic and are willing to use software that may be closed source or proprietary, such as video and other hardware drivers. I personally fall into the \u201cpragmatic\u201d camp and check this on, as I\u2019ve done here. This is a choice you will have to make, but for this article I suggest checking it on as shown in the above image and click <em>Continue<\/em>.<\/p>\n<p>In the next step, you are asked about the installation type. Since the virtual disk is empty, go with the default option of <em>Erase disk and install Ubuntu<\/em>. The other options are geared toward installation on a physical computer, or into a machine that you want to install Ubuntu side by side with another operating system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86176\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-105.png\" \/><\/p>\n<p>At this point you are ready to begin the installation, so simply click the <em>Install Now<\/em> button. Because you picked the erase disk option, you are given a warning that you are about to create changes to the target drive.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86177\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-106.png\" \/><\/p>\n<p>This is OK, it\u2019s what you want, so just click the <em>Continue<\/em> button.<\/p>\n<p>Next, you are asked what time zone you are in. VirtualBox will provide the current date\/time info from the host operating system to Ubuntu, and it will default to that time zone. If you need to use another time zone though, this is a good time to change it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86178\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-107.png\" \/><\/p>\n<p>In my case, I am in the Chicago (Central US) time zone, so I will just click <em>Continue<\/em>.<\/p>\n<p>In this next screen, you are asked for some information about your user ID in this virtual machine. Your name is up to you. Typically, you might enter your full name, such as Robert Cain. When it comes to VMs though, I generally use the same information here as my username. For the computer name, I usually begin my virtual machines with <em>vm-<\/em> in case I am using a network tool. It will be clear this is one of my virtual machines and not a physical computer. After this I\u2019ve added the same information as the name it was given in VirtualBox.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86179\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-108.png\" \/><\/p>\n<p>Next up is the username, this is a choice for you to make. Below it you will enter the password to use. Be aware this password is used for more than just logging in. Whenever you install software or alter other system settings, Ubuntu will prompt you for this password as a security measure, to confirm you have permission to make these changes. As a result, you should select a password that is complex enough to be secure, but easy to type and remember as you will be entering it a lot. Note in the above image I haven\u2019t entered the password, when you do it will appear as dots. After entering a password you\u2019ll need to re-enter it in the confirmation box.<\/p>\n<p>The last option is in regard to logging in. The default will be <em>Require my password to login<\/em>. If you are installing Ubuntu on a physical computer, or in a user testing \/ production situation, then I highly advise taking this option. In this case, you are creating a machine for simple development and learning so you might want to change it <em>Log in automatically<\/em>. If this makes you uncomfortable or violates a corporate policy, then by all means go with the default.<\/p>\n<p>Once you are ready, click <em>Continue<\/em>.<\/p>\n<p>At this point Ubuntu begins installing.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86180\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-109.png\" \/><\/p>\n<p>Here you see the progress bar. As it proceeds you will see the display update with helpful tips and tricks. Take a look at them as the install proceeds, it includes some helpful information.<\/p>\n<p>When the installation completes, you will be prompted to restart. Simply click the <em>Restart Now<\/em> button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86181\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-110.png\" \/><\/p>\n<p>After it reboots, you will be prompted to remove the installation medium then press Enter.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86182\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-111.png\" \/><\/p>\n<p>In this case VirtualBox has already taken care of this for you, so all you have to do is click the mouse inside the VM window (so it gets the focus) and press the <em>Enter<\/em> key.<\/p>\n<p>Once Ubuntu restarts again, you will be prompted to connect your online accounts.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86183\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-112.png\" \/><\/p>\n<p>Since this is a virtual machine for doing development, I usually skip this step by clicking the <em>Skip<\/em> button in the upper right.<\/p>\n<p>In the next step you are prompted to send system reports to Canonical, the makers of Ubuntu. I usually leave this at the default, but some companies have policies that state you should not share this information. Other people are not comfortable with sharing, so take which ever option you wish and click the <em>Next<\/em> button in the upper right.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86184\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-113.png\" \/><\/p>\n<p>Next Ubuntu wants to know if it can activate <em>Location services<\/em>. These services are used for things like mapping websites, or when you go to an online store. By default, it is off, and as this isn\u2019t overly useful in a virtual machine (unless you are developing software that needs these services) just take the default and click <em>Next<\/em>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86185\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-114.png\" \/><\/p>\n<p>Finally, you\u2019re done! You\u2019ve installed and configured your Ubuntu VM. You can now click <em>Done<\/em> to close out the window and begin the next steps, updating Ubuntu and installing the software you\u2019ll need.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86186\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-115.png\" \/><\/p>\n<h1>Updating Ubuntu<\/h1>\n<p>In the next article, I\u2019ll go through the process of installing PowerShell, Visual Studio Code (also known as VSCode), and Azure Data Studio. Before that, there are some updates as well as install a few small utilities that will make life easier. You may not use all of them in the next few articles, but as you move forward with your Linux experience, they will become handy to have.<\/p>\n<p>The first thing you\u2019ll find is Ubuntu has a very low timeout before it goes into lock screen mode. In my opinion, when running as a virtual machine, this is unnecessary. Your host system should be set to lock automatically after a set time, or when you choose to lock it manually. Having your virtual machine auto lock as well can get annoying. This first step is optional, but I think you\u2019ll find the short timeout annoying as well, so here\u2019s how to disable it, or if you prefer to extend the time before the VM auto locks.<\/p>\n<p>In the upper right corner, next to the battery icon, is a drop-down arrow. Clicking it will bring up a menu.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86187\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-116.png\" \/><\/p>\n<p>In the menu, click on the gear icon to bring up the settings window. If you are new to Ubuntu, I\u2019ll mention a few other things. The lock icon in the middle will lock your virtual machine. Getting your machine out of the lock state is a bit odd in that you <em>have<\/em> to press a key on the keyboard to bring up the password entry dialog. Mouse clicking has no effect.<\/p>\n<p>Next to the lock is the power button, which will give you options to shut down, reboot, and so on.<\/p>\n<p>Go ahead and click on the gear. The settings window will now appear. On the left side is a list of settings categories. Scroll down and click on the <em>Power<\/em> settings.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86188\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-117.png\" \/><\/p>\n<p>In the middle is the Power Saving area (highlighted by the orange rectangle in the above graphic). Use the drop-down to change the setting to <em>Never<\/em>, or to another setting you are comfortable with. There\u2019s no need to press any kind of a save button; when you make a change Ubuntu automatically applies it. Just click the orange X in the upper right corner to close this window.<\/p>\n<h2>Opening the Terminal<\/h2>\n<p>Now that you VM won\u2019t time out on you, you\u2019ll do a general update to Ubuntu itself. You\u2019ll be doing a lot of this through the terminal, so go ahead and open a terminal window. The 9 dot grid in the bottom left of the Ubuntu desktop is similar to the start menu in Windows. Click on it to bring up your installed applications.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86189\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-118.png\" \/><\/p>\n<p>After clicking on the \u201cstart menu\u201d the screen updates to show all your apps.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86190\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-119.png\" \/><\/p>\n<p>Over to the right is the <em>Menu Page Indicator<\/em>. The number of menu pages is dependent upon how many applications you have installed and the size of your screen. In the above screenshot the Menu Page Indicator shows I have two pages of menus; there will be a dot for each page and the solid dot indicates I am on the second page.<\/p>\n<p>To get to the terminal, find the box labeled <em>Utilities<\/em>. This is a submenu, when you click on it the Utilities expands, and in it you\u2019ll find the icon for the <em>Terminal<\/em>.<\/p>\n<p>There is a second method for getting to the terminal that you could use. Many Linux distros have a built-in keyboard shortcut to launch the terminal, in Ubuntu <em>CTRL+ALT+T<\/em> will launch a new terminal window. Other distros use the <em>Superkey+T<\/em> shortcut, where superkey would be the Windows key on many keyboards. No matter which way you choose, it\u2019s now time to open up a terminal window and continue our setup of Ubuntu.<\/p>\n<h2>Apply Updates<\/h2>\n<p>Before proceeding, you should first apply any new updates. Doing so is very easy, at the terminal window enter the following command.<\/p>\n<pre class=\"lang:none theme:none\">sudo apt-get -y update<\/pre>\n<p>The <code>sudo<\/code> command is short for <em>Super User DO<\/em>; it is the equivalent of \u201cRun as Administrator\u201d in Windows. When you enter a command using sudo you\u2019ll be prompted for your password. If you enter more sudo commands, Linux will remember your recently entered password for a brief time so you don\u2019t have to keep reentering it.<\/p>\n<p>The <em>apt<\/em> in <code>apt-get<\/code> stands for <em>Advanced Package Tool<\/em>. It, as well as the <code>apt<\/code> command you\u2019ll see in a moment, is part of a suite of tools used to install new applications or keep your system up to date. In order to understand how this works, you need to understand how Linux manages <em>packages<\/em>. Each Linux distro maintains its own set of package <em>repositories<\/em>. Think of it as a sophisticated lookup tool. When you issue an apt command to go get application \u201cX\u201d, your operating system looks in its library for \u201cX\u201d. It has an entry to go to a specific location on the internet, where application \u201cX\u201d can be downloaded, along with any special instructions for installation. Note the apt commands can also be used for more than just applications. It may also be used to install operating system updates, as in the above example, or to upgrade your operating system to a more recent version.<\/p>\n<p>It is also possible to add additional repositories to your distro. Many companies provide their own set of package repositories with which you can use the apt commands to install and update their specific applications.<\/p>\n<p>Returning to the syntax of the command, the <code>-y<\/code> tells the apt-get command to automatically reply yes to any \u201care you sure\u201d style prompts. Finally, the <code>update<\/code> tells apt-get to make sure all operating system components and applications are up to date.<\/p>\n<p>Now that you understand the basic syntax of the command, enter it and press enter. You\u2019ll be prompted to enter your password, do so and the update process will begin.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86191\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-120.png\" \/><\/p>\n<h2>Install Additional Utilities<\/h2>\n<p>There are a few utilities that you may need as you work with Ubuntu over time. While you won\u2019t necessarily use these during this course of articles, they are common to many developer installs. As you read through other tutorials here on Red Gate\u2019s Simple Talk site as well as other locations, it will be assumed you have these already installed. As such, I go ahead and install these as part of my developer installs and suggest you do so, too.<\/p>\n<h3>VIM<\/h3>\n<p>First, install a basic text editor called <em>VIM<\/em>. VIM works in the terminal and makes it easy to edit text files. To do so, use the apt command just discussed.<\/p>\n<pre class=\"lang:none theme:none\">sudo apt -y install vim<\/pre>\n<p>Note this code is using only the <code>apt<\/code> command, not apt-get. It\u2019s also using <code>install<\/code> to indicate you are installing a new application, and <code>vim<\/code> is the name of the application to install.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86192\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-121.png\" \/><\/p>\n<p>This would be an opportune time to mention that Linux is case sensitive. If I had used VIM instead of vim in the above example, the apt command would have failed.<\/p>\n<p>This also applies to file and directory names. For example, <code>myfilename.txt<\/code>, <code>MYFILENAME.TXT<\/code>, and <code>MyFileName.txt<\/code> refer to three different files, and all three could exist in the same folder.<\/p>\n<h3>net-tools<\/h3>\n<p>Having a set of network tools can be handy to do things such as discover your network status and information. Those are found in a suite of tools called <em>net-tools<\/em>. To install, use the following command.<\/p>\n<pre class=\"lang:none theme:none\">sudo apt -y install net-tools<\/pre>\n<p>Once it has installed, you can use the command <code>ifconfig<\/code> to test it, ifconfig will display your network configuration.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86193\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-122.png\" \/><\/p>\n<p>As you can see, ifconfig returns quite a bit of useful information about our machine\u2019s network info.<\/p>\n<h3>Git<\/h3>\n<p>Many developers use a code repository to store the source code to their applications. A code repository is a bit different than the Linux repositories you\u2019ve seen so far in this article. Those repositories are used to hold installable applications. The git repositories are used to hold the source code needed to build those applications.<\/p>\n<p>Git is one flavor of a repository. It can be hosted locally, within your own company, or on a platform. GitHub is probably the most popular of these and can host both public and private repositories for free. As it is used so much, I go ahead and install in every developer system I set up.<\/p>\n<pre class=\"lang:none theme:none\">sudo apt -y install git-all<\/pre>\n<p>By now most of this command should be familiar to you, <code>git-all<\/code> is the application name that will install all the git components.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86194\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-123.png\" \/><\/p>\n<p>Once installed, you can enter the command <code>git<\/code> to confirm it was installed. It will show you the basic help for the git application.<\/p>\n<h3>Snap<\/h3>\n<p>The apt command is not the only method by which you can download and install applications. The two most popular in the Linux community are <em>flatpacks<\/em> and <em>snaps<\/em>. Ubuntu favors the snap method, and the most recent versions of Ubuntu already have the snap application installed. To see if you have it, simply enter the command <code>snap<\/code> in the terminal and press enter.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"674\" class=\"wp-image-86195\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2020\/01\/word-image-124.png\" \/><\/p>\n<p>Should you get the error message that snap was not found, you can install it by using apt.<\/p>\n<pre class=\"lang:none theme:none\">sudo apt -y install snapd<\/pre>\n<p>Two things to note, first that is not a misspelling in the command, snapd is the name of the application to use. Second, snaps are only supported on Ubuntu versions 18.04 and later.<\/p>\n<h1>Conclusion<\/h1>\n<p>This article covered the first steps in setting up a development environment for developing PowerShell Core scripts in a Linux environment, specifically Ubuntu. It described using VirtualBox as the virtual machine manager, downloaded Ubuntu, and configured VirtualBox for a new Ubuntu install. With minor modifications, you could have also adopted the instructions for Hyper-V, or set up an empty PC with Ubuntu running \u201cbare metal\u201d, right on the computer itself.<\/p>\n<p>It then covered installing Ubuntu 19.10, stepping through each screen in the installation process and discussing the options, allowing for choices when installing in a virtual machine versus a real computer. After installing, you logged in, updated Ubuntu, and then added several small utilities such as VIM and the networking tools.<\/p>\n<p>In part 2 of this series, I\u2019ll demonstrate installing PowerShell Core and Visual Studio Code. In addition, you will learn how to install Azure Data Studio to prepare for future database work. I\u2019ll wrap up part 2 by automating the update to the favorites bar, configuring it for a development centric environment.<\/p>\n<p>This foundation is a good position for growth. I\u2019ll expand on the base created in parts 1 and 2 in future articles, including one on installing SQL Server in a Docker container on Linux.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since SQL Server now runs in Linux, more database professionals will begin to learn this operating system. In this article, Robert Cain demonstrates how to set up an Ubuntu virtual machine for learning.&hellip;<\/p>\n","protected":false},"author":316962,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143516,53],"tags":[95506],"coauthors":[52865],"class_list":["post-86160","post","type-post","status-publish","format-standard","hentry","category-database-devops","category-featured","tag-automate"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/86160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/316962"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=86160"}],"version-history":[{"count":5,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/86160\/revisions"}],"predecessor-version":[{"id":86645,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/86160\/revisions\/86645"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=86160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=86160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=86160"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=86160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}