Setup linux from windows

Install WSL

Prerequisites

You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.

To check your Windows version and build number, select Windows logo key + R, type winver, select OK. You can update to the latest Windows version in the Settings menu or using the Windows Update Assistant.

If you’re running an older build, or just prefer not to use the install command and would like step-by-step directions, see WSL manual installation steps for older versions.

Install

You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in PowerShell or Windows Command Prompt and then restarting your machine.

This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default, see below to change this).

The first time you launch a newly installed Linux distribution, a console window will open and you’ll be asked to wait for files to de-compress and be stored on your machine. All future launches should take less than a second.

Change the default Linux distribution installed

By default, the installed Linux distribution will be Ubuntu. This can be changed using the -d flag.

  • To change the distribution installed, enter: wsl —install -d . Replace with the name of the distribution you would like to install.
  • To see a list of available Linux distributions available for download through the online store, enter: wsl —list —online or wsl -l -o .
  • To install additional Linux distributions after the initial install, you may also use the command: wsl —install -d .

If you want to install additional distributions from inside a Linux/Bash command line (rather than from PowerShell or Command Prompt), you must use .exe in the command: wsl.exe —install -d or to list available distributions: wsl.exe -l -o .

If you run into an issue during the install process, check the installation section of the troubleshooting guide.

Set up your Linux user info

Once you have installed WSL, you will need to create a user account and password for your newly installed Linux distribution. See the Best practices for setting up a WSL development environment guide to learn more.

Set up and best practices

We recommend following our Best practices for setting up a WSL development environment guide for a step-by-step walk-through of how to set up a user name and password for your installed Linux distribution(s), using basic WSL commands, installing and customizing Windows Terminal, set up for Git version control, code editing and debugging using the VS Code remote server, good practices for file storage, setting up a database, mounting an external drive, setting up GPU acceleration, and more.

Want to try the latest WSL preview features?

Try the most recent features or updates to WSL by joining the Windows Insiders Program. Once you have joined Windows Insiders, you can choose the channel you would like to receive preview builds from inside the Windows settings menu to automatically receive any WSL updates or preview features associated with that build. You can choose from:

  • Dev channel: Most recent updates, but low stability.
  • Beta channel: Ideal for early adopters, more reliable builds than the Dev channel.
  • Release Preview channel: Preview fixes and key features on the next version of Windows just before its available to the general public.

Источник

Как работать с Linux используя Windows

Если вы только начали свой путь разработчика и до сих используете операционную систему семейства Microsoft Windows, то уже наверняка столкнулись с ситуацией, когда ваш инструментарий отличается от того, что установлено у большинства людей из этой профессии. Чаще всего проблемы начинаются при работе в командной строке. Дело в том, что Windows не является POSIX-совместимой операционной системой, поэтому в ней отсутствует базовый набор прикладных программ, который необходим для разработки.

Читайте также:  Windows 10 vac ban

Этот вопрос можно решить установкой какого-либо из многочисленных дистрибутивов Linux в качестве основной, либо альтернативной операционной системы. Для новичков есть способ проще и быстрее — технологии виртуализации. Об этом и поговорим.

Ubuntu из Microsoft Store

Если вы работаете на Windows версии 10 с архитектурой x64, то можно можно воспользоваться встроенным решением и установить слой совместимости (Windows Subsystem for Linux) на основе Ubuntu Linux через магазин приложений Microsoft Store.

Перед тем как начать, необходимо убедиться, что системные требования соответствуют рекомендованным. Для этого запустите приложение Microsoft Store, введите в графе поиска Ubuntu и перейдите по найденной ссылке. Если ранее Windows не обновлялся, то вероятней всего вы получите соответствующее указание сделать это до начала установки Ubuntu. Если всё OK, то нажимайте на кнопку «Получить» и через несколько минут (в зависимости от скорости интернет соединения) вы получите сигнал об успешной установке приложения.

Первый запуск может вызвать ошибку Error: 0x8007007e и предложение прочитать инструкцию по её решению https://aka.ms/wslinstall. Если хотите сэкономить время, то просто запустите PowerShell (не путать с cmd ) от имени администратора и выполните следующую команду:

После этого компьютер попросит перегрузиться, а потом нужно снова запустить приложение Ubuntu. В случае удачной установки откроется интерпретатор командной строки с предложением ввести имя пользователя и пароль. Выглядеть это будет вот так:

Преимущество такого способа установки позволяют стереть грань между операционными системами и получить доступ ко всему инструментарию Linux ( bash , ssh , git , apt и так далее) из стандартной командной строки Windows не теряя привычное окружение и оставаясь на одном файловом уровне.

Ссылки на официальную документацию:

VirtualBox

Если вы работаете на Windows версии ниже 10 или хотите получить изолированную операционную систему Linux, да ещё и с графическим окружением, то можно воспользоваться сторонним бесплатным программным продуктом под названием VirtualBox.

Инсталлятор Oracle VM VirtualBox для Windows Hosts
Ссылка на скачивание: Download Oracle VM VirtualBox

Образ операционной системы Ubuntu Linux в формате ISO
Ссылка на скачивание: Download Ubuntu Desktop

Для начала необходимо установить и запустить приложение VirtualBox.

Нажимаем кнопку «Создать», выбираем из списка тип операционной системы «Linux», если нет своих предпочтений по дистрибутиву, то выбираем версию «Ubuntu» 32 или 64 битной архитектуры, а название можно ввести любое.

Указываем объём оперативной памяти выделенной под виртуальную систему. Рекомендованный объём составляет 1024 MB.

Указываем объём дискового пространства выделенного под виртуальную систему. Рекомендованный объём составляет 10 GB.

Тип виртуального жёсткого диска можно оставить как есть — VDI (VitrualBox Disk Image).

Формат хранения данных выберите исходя из личных предпочтений. Динамический виртуальный жёсткий диск растёт по мере заполнения, а фиксированный создаётся сразу того размера, который был указан на предыдущем шаге.

Имя и размер файла можно оставить без изменений и сразу нажать на кнопку «Создать».

По завершению у вас будет создана виртуальная машина, но она пока без операционной системы. Для того чтобы её установить, нужно скачать Ubuntu Linux (32-bit или 64-bit, в зависимости от того, что было выбрано на шаге, где мы указывали тип ОС).

Нажатие на кнопку «Запустить» должно привести к появлению диалогового окна с предложением указать путь до скаченного ISO образа. Сделайте этого и нажмите кнопку «Продолжить»

Виртуальная машина автоматически будет выполнять часть процессов, но в некоторых операциях всё же потребуется участие пользователя.

Выберите языковую поддержку в списке слева и нажмите «Установить Ubuntu».

Можно загрузить обновления сразу на этапе установки.

Без особых опасений выбираем пункт «Стереть диск и установить Ubuntu» и двигаемся дальше.

Если вы выбрали русский язык на первом этапе установки, то вам предложат русскую раскладку клавиатуры в качестве дополнительной.

Читайте также:  Сервер iis php windows 2012

Заполните поля и выберите режим входа в систему.

Далее начнётся процедура разметки диска, переноса файлов, установка обновлений и другие процессы, которые не потребуют прямого участия пользователя.

По завершению виртуальный компьютер перезагрузится и вы попадёте в уже установленную среду Ubuntu Linux.

Но это ещё не всё. Весьма желательно установить так называемые «Дополнения гостевой ОС». Они содержат драйверы и прочие системные файлы, необходимые для наилучшей производительности и обеспечения дополнительных функциональных возможностей между виртуальной и гостевой операционными системами.

Выберите пункт меню «Устройства» программы VitrualBox, подпункт «Подключить образ диска Дополнений гостевой ОС…» и дождитесь предложение запустить приложение для автоматического запуска с виртуального привода.

Виртуальная ОС Ubuntu Linux установлена и готова к работе.

Ссылка на официальную документацию: Oracle VM VirtualBox User Manual

Источник

Ubuntu Documentation

Style Cleanup Required
This article does not follow the style standards in the Wiki Guide. More info.

Automatic process

UNetbootin is an installer that can do the following automatically. It is available for download at http://unetbootin.sourceforge.net/.

Instlux is an installer that does all of the following for you, however it only supports older versions of Ubuntu. You can download it from http://www.sourceforge.net/projects/instlux.

Wubi is an installer that uses a process similar to what described in this page, but the installation takes place within a file inside Windows, and hence, differently from the other approaches, it does not require to modify the partitions. In any case, if you later want install it to a dedicated partition, you can do it. See https://wiki.ubuntu.com/WubiGuide.

Manual process

The netboot approach

This page will guide you through obtaining the files necessary to boot the Ubuntu installation from a FAT or NTFS partition, thus allowing you to install Ubuntu without any sort of removeable media. This guide assumes that you are running either some NT-based Windows(NT, 2000, XP) or Windows 9x (95, 98, ME).

Create a directory called boot in the root directory of the first primary partition of your hard drive (usually drive c:\, which it will be referred to as from now on).

The following steps depend on which version of Windows you are using:

Windows 95/98/ME (using Loadlin)

Download loadlin.exe.gz from https://passechambre.appspot.com/show/indexothers.html and unpack it to boot (If your default compression/archive program doesn’t like *.tar.gz files, try 7-Zip from http://www.7-zip.org)

Choose Reboot in MS-DOS mode in the shutdown menu orpress F8 (Ctrl for Win98/ME) during boot and choose command prompt only in order to start Windows in DOS mode

  • Get into the boot directory and run loadlin:
  • Now you should have a network installation going

    Note: On some computers the installer has problems with the video card and you may get a «melting screen». I replaced vga=normal with vga=771 and it worked on my laptop Stjepan Stamenkovic

    Windows NT/2000/XP (using Grub)

    Extract grldr from the archive to c:\.

    Create a new folder in c:\boot\ called grub.

    Extract menu.lst (Should be in the /boot/grub folder of the archive) to c:\boot\grub The rest of the files in the archive are unnecessary. (If your default compression/archive program doesn’t like *.tar.gz files, try 7-Zip from http://www.7-zip.org or TUGzip from http://www.tugzip.com.)

    Append c:\grldr="Install Ubuntu" to c:\boot.ini.

    Note: Eventhough c:\boot.ini is not shown by the explorer, this file exists and can be also opened in the notepad. Just write the path c:\Boot.ini at the open dialog.

    Open menu.lst in a text editor and paste the following text in the file:

    Save menu.lst, reboot, and select «Install Ubuntu» in the windows OS chooser then in GRUB. You now have a network installation of Ubuntu going.

    This procedure should be possible using a disk image, but it may be necessary to use a different kernel and pass some special argument in menu.lst to tell it to boot from the CD image (Has been achieved using Knoppix).

    It would be nice if someone could automate this process. InstallationUbuntuFromWindows outlines how such an installation system might work.

    Читайте также:  Linux как выключить экран

    The CD approach

    This approach is documented in the Installation notes, however it seemed appropiate to put a reference to it here.

    Note: This method only works with the Alternate Ubuntu install CD.

    If you can’t boot from the CD-ROM directly it is possible to use the above approach to boot the kernel from the HDD and have the installation follow through on the CD-ROM.

    Create a directory called ubuntu in the root directory of the first primary partition of your hard drive (usually drive c:\, which it will be referred to as from now on).

    Download the ALTERNATE ubuntu-installer CD from http://www.ubuntulinux.org/download/ and burn the CD, then copy the contents of the CD to ubuntu.

    Note: If you can’t/don’t want to burn a cd you can also mount the iso with a program like Daemon Tools or Alcohol 120% or simply open the iso file using 7-Zip

    Extract grldr from the archive to c:\grldr. The rest of the files in the archive are unnecessary. (If your default compression/archive program doesn’t like *.tar.gz files, try 7-Zip from http://www.7-zip.org.)

    Append c:\grldr="Install Ubuntu" to c:\boot.ini.

    Note: Eventhough c:\boot.ini is not shown by the explorer, this file exists and can be also opened in the notepad. Just write the path c:\Boot.ini at the open dialog.

    Create a new text file called menu.lst and save it to the first primary partition of your hard drive.

    Open menu.lst in a text editor and paste the following text in the file:

    Save menu.lst, reboot with the Ubuntu installer CD in the drive, and select «Install Ubuntu» twice. You now have a CD installation of Ubuntu going.

    The CD image approach

    Note: This method only works with the Alternate Ubuntu install CD.

    If for some reason you can not (do not want to) write the CD it is possible to use the ISO image to do the installation from hard disk.

    Create a directory called ubuntu in the root directory of the first primary partition of your hard drive (usually drive c:\, which it will be referred to as from now on).

    Download the ALTERNATE ubuntu-installer CD from http://www.ubuntulinux.org/download/ and save the .iso file in the root directory of first partition of your hard drive .

    Extract grldr from the archive to c:\grldr. The rest of the files in the archive are unnecessary.

    Append c:\grldr="Install Ubuntu" to c:\boot.ini.

    Note: Eventhough C:\boot.ini is not shown (by default) by Windows Explorer, this file exists and can be also opened in the notepad. Just write the path C:\boot.ini at the open dialog.

    Create a new text file called menu.lst and save it to the first primary partition of your hard drive.

    Open menu.lst in a text editor and paste the following text in the file:

    Save menu.lst, reboot, select «Install Ubuntu» twice. You now have a CD image installation of Ubuntu going.

    If you are installing onto the disk that is hosting the installer, and during partitioning the installer says that the kernel cannot read the new partition table, and that you should reboot your system, don’t. The partitioner has already flagged the new Linux partition as the boot partition, so the system will be unbootable. If you’re dealing with a system with no floppy or CD drive, you will be stuck. Instead, use Alt-F2, Enter to open a console and use cfdisk to set the boot partition back to the partition which hosts the installer, then go back to the installer using Alt-F1, as many times as needed to get to the menu, then select «Abort Installation» to reboot.

    Installation/FromWindows (последним исправлял пользователь yousef-el-sayed 2014-07-03 06:57:04)

    The material on this wiki is available under a free license, see Copyright / License for details
    You can contribute to this wiki, see Wiki Guide for details

    Источник

    Оцените статью