Running linux on ios

Wait, what’s iSH?

iSH running on an iPhone

iSH is a project to get a Linux shell environment running locally on your iOS device, using a usermode x86 emulator.

iPadOS? You bet.

iSH also runs on iPad, bringing a terminal to larger displays as well.

iSH running on an iPad

BusyBox

You can edit files with sed and cat, move them around, and more!

Starting BusyBox on an iPhone

Keyboard CTRL

iSH’s keyboard addition makes navigation easier.

The iSH keyboard addition as seen on an iPhone

Sounds cool, can I get that?

Of course, let’s get started!

AltStore logo

You can become a patron if you would like support iSH. Donations are very much appreciated, but will never be required; the app will always be completely free.

New in iSH 1.3 (build 482)

New stuff: — iSH now supports custom themes — Preferences are now exposed via procfs — Some more app icon choices — Hyperlinks created by OSC 8 are underlined instead of invisible Fixed bugs: — Forward SO_RCVTIMEO, SO_SNDTIMEO in setsockopts to support snac — Add about four dozen SIMD instructions to improve support for nodejs and Rust — Fix bottom keyboard inset for iPad, Stage Manager, and devices with no home button — Implement /proc/pid/task to fix recent versions of GDB — Fix VoiceOver focus stealing keyboard focus on iOS 15+ — Resolve an issue with xadd causing git clones to hang — Trigger segfault on unaligned cmpxchg8b, which iSH does not support — Fix a race condition that causes some output to be lost — Fix toolbar button sizing

Источник

Run the Linux command line on your iPad

gadgets

Did you know that you can run a Linux command line on your iOS device? You might be asking, «why would I want to use text-based applications on my tiny iPhone?» OK, fair enough. That is a pretty reasonable question. But if you’re reading Opensource.com, you probably know the answer: Linux users want to be able to use any device, and they also want to use their own customizations.

And most of all, they want a challenge.

I have a seven-year-old iPad 2 Mini that still works fine for reading e-books and other tasks. But I also want to use it to access the command line for applications and my suite of programs and scripts I can’t seem to do without. I want the environment I’m accustomed to, as well as my standard development environment. Here’s how I did it.

Connect to a keyboard

Using the command line for programming on a phone or tablet’s onscreen keyboard is not a lot of fun. I recommend connecting an external keyboard, either through Bluetooth or by using a camera connection kit adapter to connect a wired keyboard (my preference). Plugging my Kinesis Advantage split keyboard into my iPhone 6 makes for some strange optics, like a corp’s cyberdeck from the classic role-playing game Shadowrun.

Читайте также:  Astra linux fly admin policy

Get a shell on iOS

You have two options for running a complete Linux system on iOS:

  • Secure shell (SSH) into a Linux computer
  • Run a virtualized system using Alpine Linux with iSH, which is open source, but must be installed using Apple’s proprietary TestFlight app

Alternatively, there are two open source terminal emulator apps that provide open source tools within a restricted environment. This is the most limited option—it doesn’t really let you run Linux, but you are running Linux tools. There are heavy restrictions on what you can do on the device with these apps, but they do get you some command-line functionality.

I’ll look at the simplest approach before exploring more challenging solutions.

Option 1: A sandboxed shell

One of the easiest ways to get started is with the iOS app LibTerm. This is a sandboxed open source command-line shell with 80+ commands bundled in a $0 app. It ships with Python 2.7, Python 3.7, Lua, C, Clang, and more.

Along similar lines is a-Shell, described as a «text-based user interface for a screen-based platform.» a-Shell is open source, in active development, grants access to the filesystem, and ships with Lua, Python, Tex, Vim, JavaScript, C, and C++, along with Clang and Clang++. It even allows you to install Python packages with pip.

Option 2: SSH anywhere

One step up from downloading an app is configuring an SSH client. For a long time now, it’s been possible to use one of many SSH client apps on iOS to connect to a server running a Linux distro or BSD. The advantage of using SSH is that your server can be running any distro with any software you like. You work remotely, and your output just gets piped to your iOS device’s terminal emulator.

Blink shell is a popular paid open source SSH app. Outside of the small screen, using this software is akin to connecting to a server via any other command prompt. Blink’s terminal looks beautiful, with a number of included themes and the ability to create your own themes, including customizing and adding new fonts.

Option 3: Run Linux

Using SSH to connect to a server running Linux is a great way to access a prompt, but it does require access to an external server and a connection. This isn’t the worst barrier to entry, but it’s not completely negligible, and you may want to use Linux without this server requirement.

If that’s your case, you’ll have to break out something a bit more on the cutting edge. TestFlight is a proprietary service for deploying in-development apps before they’re submitted to Apple’s App Store. You can download the TestFlight app from the store, and then sign up for a number of test applications. Apps in TestFlight allow a limited number of external beta testers (generally up to 10,000) for a limited amount of time. To download a test app, you must access a link directly from your device, which is generally found on the test app developer’s website.

Run Alpine Linux with iSH

iSH is an open source TestFlight app that runs a virtual machine with the Alpine Linux distro out of the box (but you can run other distributions with a bit more tinkering).

An important caveat: this is experimental. Since iSH is currently a test app, don’t expect permanent or robust service. TestFlight apps are time-limited. My current build lasts 60 days. This means that in 60 days, I’ll be locked out and have to rejoin iSH’s next testing phase. Furthermore, I’ll lose my files unless I export them with Files on iOS or back them up to a Git host or with SSH. To be clear: Don’t rely on this to continue working! Don’t put anything on here that is essential! Back up your work elsewhere!

Install iSH

Get started by installing TestFlight through the App Store. Then install iSH by getting the install link through its website. There is another installation method that uses the AltStore, but I have not tried it. Or, if you have a paid developer account, you can download iSH’s repo from GitHub and deploy it yourself.

Читайте также:  Linux удалить старые пакеты

Using the link, TestFlight installs an iSH app on your device. Like any other app, it appears on your screen with an icon.

Manage packages

iSH runs an x86 emulator with Alpine Linux. Alpine is a tiny, under-5MB distro. This was my first time running Alpine, and I thought I’d get frustrated with such a minimal distro, but I actually really enjoyed it.

Alpine Linux on iOS

Alpine uses the apk package manager, which is simpler than even apt or pacman.

Find other commands and info with:

Update the package manager:

Get a text editor

Alpine’s default text editor is Vi, but I prefer Vim, so I installed it:

You could install Nano or Emacs, if you prefer.

Change the shell

I don’t know about you, but I need the fish shell. Other folks prefer Bash or Zsh. But Alpine uses ash! Ash is a fork of Dash shell, itself a fork of the original ash or Almquist shell. It is designed for speed. I decided to trade speed in favor of the built-in auto-completion, color, Vim-key control, and syntax highlighting that I know and love in fish shell.

If you want Bash and its completions and man pages instead, you need to install them and some extra things:

apk add bash bash-doc bash-completion

Alpine’s minimalist ideology generally means that some programs that would be a single package in other distros are split into multiple smaller packages. This also means you can customize and slim down your system exactly how you want.

You can find more details on installing Bash in this tutorial.

Change the default shell

After installing fish, you can temporarily switch to it and try it out by typing fish and dropping into the shell. But I want to make fish my default shell, and the chsh command I’m used to from other distros doesn’t work.

First, find out where fish is installed:

Next, edit the login shell to use fish. You can use any editor you’re comfortable with. If you’re a beginner, install Nano (with apk add nano ) so that you can edit config files and save them with CTRL+X, confirm, and quit.

To make fish the default, change that line to:

root:x:0:0:root:/root:/usr/bin/fish

I’m sure there is a good way to re-source the shell so that you can start using it right away. But I’m not sure, so I recommend returning to the app browser, force-quitting the shell, and for good measure, shutting down and restarting your iPad or iPhone. Reopen iSH, and now, in addition to the «Welcome to Alpine!» message and info on getting started with apk, you will see the default fish login welcome message: Welcome to fish, the friendly interactive shell. Hooray!

Читайте также:  Linux write file to socket

Fish shell on Alpine Linux

Set up Python and pip

I decided to add Python (version 3.x), not just so I could write code but because I rely on several Python programs. Install it:

Although Python 2.x is deprecated, you can still install it:

Install the Python package manager, pip, and setuptools:

python3 -m ensurepip --default-pip

It takes some time to install and set up the package manager, so just wait.

Then, you can download curl, the networking transfer tool:

Read the manual

Fish uses built-in auto-completion based on man pages. Like other command-line users, I rely on the man manual, and Alpine doesn’t come with it installed. So, I installed it along with the less pager:

apk add man man-pages less less-doc

In addition to man, I use the fabulous tldr pages project, which provides simplified, community-driven man pages.

The tldr command connects to the web to fetch pages whenever it encounters a request for a new one. If you need to learn how to use a command, you can just type something like tldr curl to get a plain-English explanation and good examples of how to use the command.

You could, of course, automate all of this installation work with dotfiles or an install script, but that wouldn’t really fall within the Alpine way of customizing a minimal install exactly to your specifications. Besides, it didn’t take that long, did it?

Learn more

The iSH wiki contains a «what works» page with reports on what packages currently work. Of note, npm does not appear to work at this time.

Another wiki page explains how you can access iSH files from the iOS Files app. This is one way you can move and transfer files.

You could also install Git (yep! apk add git ) and push your work to a remote repo or transfer it to a server over SSH. And, of course, you can download and run any number of fabulous open source projects from GitHub on your system.

For more information about iSH, consult these links:

An introduction to GNU Screen

Why I switched from Mac to Linux

After 25 years, Lee made the switch to Linux and couldn’t be happier. Here’s what he uses.

Woman programming

Try Linux on your Mac with open source virtualization

Take Fedora out for a test run on your macOS machine using QEMU virtualization.

Getting started with Perlbrew

4 Mac terminal customizations even a curmudgeon can love

Open source means I can find Linux familiarity on any terminal.

Источник

Running linux on ios

Logo

The iPad is too powerful to not get the Linux treatment.

Linux on iPad

Linux on the iPad isn’t a reality yet, at least not like on a desktop platform. With hardware becoming more and more powerful every year, obsolete iPads ( according to Apple) should be allowed to continue to serve a purpose. Obsolete iPads could be affordable personal computers and useful for project builds. We believe Linux is the key to bring new life to these devices.

Current Options

Released

Current

iSH
The Linux shell on iPadOS

UTM
Run virtual machines on iOS & iPadOS

Outdated

QMole
Linux Compatibility Container for iPad

iPad 1 Compatibility Layer

Dev Tools

Released

Project Sandcastle
Linux and Android on iPhone 7

checkra1n / PongoOS
Semi-tethered jailbreak to all, based on the ‘checkm8’ bootrom exploit.

Work in Progress

Linux Apple Resources
Guide to building and booting Linux on iDevices w/ custom Linux kernel by SoMainline

A7 – A11 Kernel & Guide Bootable OS

Additional Projects

Work in Progress

postmarketOS
Touch-optimized and pre-configured Alpine Linux

Источник

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