Here are three main methods to simulate a Linux environment on Windows:
1. Using VMware and other virtual machines:
Advantages: Powerful functionality, almost completely simulates the Linux environment.
Disadvantages: Consumes a lot of system resources, relatively slow running speed.
2. Using Cygwin and other emulation environments:
Advantages: Simulates Linux functions through programs running on Windows, relatively simple to install and use.
Disadvantages: Has differences from the actual Linux environment, incomplete functionality simulation, prone to conflicts.
3. Using colinux/andlinux and other special emulation environments:
Advantages: Uses special drivers to allow the emulation environment to run in ring0 privilege mode, fast and stable.
Disadvantages: Relatively complex to install and configure.
Installing colinux
1. Download the colinux installation file and install it in the default directory `C:\colinux`.
2. Choose not to download the file system, then download a suitable kernel version file system from the website and extract it to the colinux installation directory (or another directory, modifying the corresponding configuration if needed).
3. Copy `example.conf` and rename it to `Ubuntu.conf`, then open it and modify the file system’s filename:
cobd0="c:\coLinux\Ubuntu-6.06.1.ext3.1gb"
4. If you want to increase colinux’s memory, modify the `mem` option:
mem=256
5. Open the console, navigate to the `C:\colinux` directory, and enter the command to start colinux:
colinux-daemon.exe @Ubuntu.conf
Enter the username `root` and password `root`, and colinux will run.
6. To simplify starting colinux, create a batch file `start.bat` with the above command, so you can double-click it to start colinux.
Sharing files with Windows
Add the following configuration in `example.conf`:
cofs0=C:\coLinux
cofs1=D:\coLinux
The number after `cofs` can keep increasing.
Then, enter the following command in colinux:
mount -t cofs 0 /mnt/share
This maps the `C:\coLinux` folder to the `/mnt/share` directory.
Configuring colinux network
1. After installation, colinux will automatically install a virtual network adapter. Right-click “My Network Places” and you will see a new “Local Area Connection 2”.
2. Rename “Local Area Connection 2” to `colinux` (or any name you prefer).
3. Unplug the network cable (this is very important, otherwise you cannot set up connection sharing).
4. Right-click “Local Area Connection” and select “Advanced”, check “Allow other network users to connect through this computer’s Internet connection”. The IP of the colinux connection will be set to `192.168.0.1`. If it conflicts with your gateway IP (if your gateway IP is `192.168.1.1`, you can skip this step), change it to `192.168.1.1`. Disable and re-enable the local connection, so it won’t affect Windows’ internet access.
5. Open the colinux `conf` configuration file and add the following configuration:
eth0=tuntap,"colinux"
If there’s already an `eth0` configuration, comment it out with `#`.
6. Open `/etc/network/interfaces` and modify it as follows:
# Second network (tap-win32) auto eth0 iface eth0 inet static address 192.168.1.40 netmask 255.255.255.0 gateway 192.168.1.1
7. Open `/etc/resolv.conf` and modify the DNS:
nameserver 202.117.80.3
8. Restart colinux.
Testing internet access
Test if colinux can access the internet:
ping 192.168.1.1
Installing Development Tools
Update and install development tools:
apt-get update
apt-get install man gcc make libc6-dev
Optional: installing Samba
With the Samba service, you can access colinux files from Windows like a local network share:
apt-get install samba
useradd user_name
smbpasswd -a user_name
Edit `/etc/samba/smb.conf` and add the following content:
[Linux Share]
comment = Linux Share Docs
browseable = yes
writable = yes
create mask = 0775
path = /root
Restart the Samba server:
/etc/rc3.d/S20samba restart
Optional: installing SSH
SSH is a remote login protocol similar to telnet. After installation, you can remotely log in to colinux from Windows using an SSH client:
apt-get install ssh
Install an SSH client on Windows, such as SSH Secure Shell or PuTTY, enter colinux’s IP address and your username and password to log in remotely.
Conclusion
These methods—VMware, Cygwin, and colinux—provide various ways to simulate Linux on Windows, balancing resource use, speed, and functionality to suit different user needs and preferences.