Tutorial to Upload and Extract a Zip File from Windows to a CentOS VPS
On Linux files are normally compressed individually to create a .gzip version using the gzip utility. Or several files are collected into a Tape Archive, .tar, which is an uncompressed collection of files created using the tar utility. A .tar is then compressed to a .gzip to create a .tar.gz. In Windows files are normally zipped, which is a format that collects and compresses several files into a single .zip file in a single operation.
When managing a Linux based Virtual Private Server (VPS) or other remote Linux machine, such as a web server, there can be occasions when a zip file created on Windows needs to be extracted and managed on the remote Linux machine. This can be done with the Linux zip (to compress) and unzip (to extract) utilities.
Install Zip and Unzip onto CentOS
A VPS may not run a full blown Linux, for example a CentOS VPS may run the minimal CentOS installation for efficiency. In which case the zip and unzip utilities may not be installed. These utilities can be installed on CentOS using yum:
1
|
# yum install zip unzip
|
or for sudo users:
1
|
$ sudo yum install zip unzip
|
To check if zip or unzip is installed the commands “yum info zip unzip” or “yum list installed | grep zip” are sometimes suggested. A more concise command is simply:
1
2
3
|
# rpm -q unzip zip
unzip–6.0–2.el6_6.x86_64
package zip is not installed
|
Here showing that unzip is installed but not zip.
Upload a Zip File to a Linux VPS from Windows
For a VPS or other remote machines the service provider may have installed software to allow for files to be uploaded. The upload functionality is normally part of a file manager utility, provided as part of a control panel package, such as the popular cPanel. If a file manager is not available then the upload can be done via secure copy, scp, based on the secure shell (ssh) protocol. (See also the Webmin option further on).
The well established PuTTY program is used as a secure shell for Windows computers (see SSH into VPS Virtual Machine on Windows Using PuTTY), it supports secure copy with the pscp utility. This can be used to copy a zip from Windows to a remote Linux VPS. However, it is run from a command (DOS) prompt and it can be difficult getting the correct command line arguments. An easier to use alternative is WinSCP. The WinSCP program provides a GUI interface and supports drag and drop transfers between a Windows machine and Linux box. Login is the same as PuTTY, providing a server name or IP address, username and password.
WinSCP shows an interface with both the local and remote computer directories. Find the zip file on the local machine and drag and drop it to the required directory on the remote Linux machine.
Use wget to Transfer Zip Files Between Remote Servers
To transfer a zip file between remote servers it isn’t necessary to do a download to a local machine first. If the zip file is on a public web location then use the wget utility in the secure shell to copy it to the other remote machine directly. Again for minimal Linux systems wget may require installation. On minimal CentOS use yum to install wget:
1
|
# yum install wget
|
To grab the remote zip file just pass the HTTP address to wget (change directory to the location you want to store the zip file first).
1
|
# wget http://www.example,com/zipped_files.zip
|
Unzip File using Unzip
To extract the files use the unzip command:.
1
|
# unzip zipped_files.zip
|
To see a list of supported commands use the help option:
1
|
# unzip –help
|
Upload and Unzip with Webmin
If the VPS or remote Linux machine does not come with a control panel it is possible to use one of several freely available, for example Webmin. See Webmin CentOS Install for Easier VPS Management. The free Webmin control panel has a File Manager that can be used for uploading and unzipping. Note that the unzip utility must be installed as previously shown. Plus the Webmin File Manager requires Java to be installed onto your local machine (the File Manager is a Java Applet).
(Note: Webmin’s File Manager may not work with Java 8. Use Java 7 or the WinSCP method.)
Use the Upload icon to select the file and chose the Uncompress ZIP option. The Extract icon can be used to unzip an existing zip file on the remote Linux box.
Unzip File on VPS From Windows Summary
- Install zip and unzip using yum on CentOS (yum install zip unzip).
- If supported use the control panel file manager to upload and optionally unzip (Webmin is a free control panel).
- Use secure copy with WinSCP or the PuTTY program pscp to send the file to the remote VPS.
- Use the unzip utiltiy(unzip filename.zip).
No Comment