setting up File Storage on OCI and uploading files through Filezilla FTP

Goal

The goal of this blog is to setup Oracle Cloud Infrastructure File Storage – OCI FS , upload files into it through any FTP client such as Filezilla, You can upload terabytes of data and this is very much scalable and elastic, You can also access the uploaded files through the Compute Machines that are running.Also its easier that it needs no FTP Server to be installed

Create File Storage 

In this case we will give name as cb1files 

Select path as cb1files

Select our Generic Network that we had created earlier ( refer link )

Make Note of Ubuntu Commands or Linux based on the OS that you want this to be mounted, in my case i am selecting Ubuntu

Mount File System 

ubuntu@cblogs2:~$ sudo apt-get install nfs-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  grub-pc-bin linux-headers-virtual linux-image-virtual
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  keyutils libnfsidmap2 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib 
libtirpc1 python python-minimal python2.7 python2.7-minimal rpcbind
Suggested packages:
...
ubuntu@cblogs2:~$ sudo mount 10.0.0.8:/cb1files /mnt/cb1files
- Connection Timed out ...

Open the Following Ports 111 and 2048 to 2050 type TCP

Access the VMs security list and open the following ports 111, 2048 to 2050 by Editing the security list

Check if we can mount now

ubuntu@cblogs2:~$ sudo mount 10.0.0.8:/cb1files /mnt/cb1files
ubuntu@cblogs2:~$ df -h
Filesystem          Size  Used Avail Use% Mounted on
udev                6.9G     0  6.9G   0% /dev
tmpfs               1.4G  8.7M  1.4G   1% /run
/dev/sda1            97G  2.3G   95G   3% /
tmpfs               6.9G     0  6.9G   0% /dev/shm
tmpfs               5.0M     0  5.0M   0% /run/lock
tmpfs               6.9G     0  6.9G   0% /sys/fs/cgroup
/dev/sda15          105M  3.4M  101M   4% /boot/efi
tmpfs               1.4G     0  1.4G   0% /run/user/1000
10.0.0.8:/cb1files  100G     0  100G   0% /mnt/cb1files

Create a new folder make ubuntu user to have full permission over it

ubuntu@cblogs2:~$ cd /mnt/cb1files/
ubuntu@cblogs2:/mnt/cb1files$ ls
ubuntu@cblogs2:/mnt/cb1files$ vi myfile.txt
ubuntu@cblogs2:/mnt/cb1files$ sudo vi myfile.txt
ubuntu@cblogs2:/mnt/cb1files$ ls
myfile.txt
ubuntu@cblogs2:/mnt/cb1files$ cat myfile.txt
Hello World !
ubuntu@cblogs2:/mnt/cb1files$ 
ubuntu@cblogs2:/mnt/cb1files$ mkdir ubuntufiles
ubuntu@cblogs2:/mnt/cb1files$ sudo chown -R ubuntu:ubuntu /mnt/cb1files/ubuntufiles/ 
ubuntu@cblogs2:/mnt/cb1files$ sudo chmod -R g+rwX /mnt/cb1files/ubuntufiles/

Upload Files through FTP 

Check this blog link for how to setup FTP Connection

Reality Check

 
ubuntu@cblogs2:/mnt/cb1files/ubuntufiles$ ll
total 9
drwxrwxr-x 2 ubuntu ubuntu    1 Jul  6 10:35 ./
drwxr-xr-x 3 ubuntu ubuntu    2 Jul  6 10:33 ../
-rw-rw-r-- 1 ubuntu ubuntu 1293 Jul  6 10:35 Notes.txt

Making your mounted directory as Apache root

sudo chown -R www-data:www-data /mnt/cb1files/ubuntufiles/
sudo vi /etc/apache2/apache2.conf

# Directory /var/www/ 
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
# /Directory 

 Directory /mnt/cb1files/ubuntufiles/ 
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
 /Directory 

sudo vi /etc/apache2/sites-available/000-default.conf

#DocumentRoot /var/www/html
DocumentRoot /mnt/cb1files/ubuntufiles

sudo service apache2 restart

Now you should be to directly upload your php files to the mounted storage volume