To set up and configure a MinIO environment, follow the steps below:
- Download the MinIO binary from the official website for your operating system.
- Extract the downloaded binary to your target folder.
- Create a data storage directory inside your chosen location.
- Add the MinIO binary to your system PATH sothat the
miniocommand is available from any directory. - Start the MinIO server from the command line, specifying the data directory and custom access credentials:
minio server /path/to/data --address localhost:9000 --access-key YOUR_ACCESS_KEY --secret-key YOUR_SECRET_KEY
Replace /path/to/data with the directory created in step 3, and choose your own YOUR_ACCESS_KEY and YOUR_SECRET_KEY.
- Open a web browser and navigate to
http://localhost:9000to access the MinIO management console. From here you can manage buckets, upload files, and perform other operations. - To interact with MinIO using the command-line client, install the MinIO client, then configure it:
minio config set url http://localhost:9000
minio config set access_key YOUR_ACCESS_KEY
minio config set secret_key YOUR_SECRET_KEY
Replace http://localhost:9000 with your server address and use the credentials defined in step 5.
After completing these steps, your MinIO environment is ready. You can now upload, download, and manage files through the console or the MinIO client.
Configuring MinIO in IntelliJ IDEA
- Create a new Java project in IntelliJ IDEA, or open an existing one.
- Download the MinIO Java client library from the official GitHub repository.
- Place the downloaded JAR file (e.g.,
minio-x.x.x.jar) into the project’slibfolder. - Open the Project Structure dialog via File > Project Structure.
- Switch to the Libraries tab and click the + button, then choose Java.
- Select the MinIO JAR file you added in step 3 and click OK.
- Add a new Java class to your project.
- Write code that interacts with the MinIO server using the MinIO Java client library. For example:
import io.minio.MinioClient;
import io.minio.errors.MinioException;
public class StorageExample {
public static void main(String[] args) {
try {
MinioClient client = new MinioClient("http://localhost:9000", "YOUR_ACCESS_KEY", "YOUR_SECRET_KEY");
client.putObject("uploads", "document.txt", "/tmp/document.txt");
} catch (MinioException ex) {
System.err.println("MinIO error: " + ex);
}
}
}
Replace http://localhost:9000 with your server address and use the access credentials you configured.
- Run the class using the run button (green triangle) in IntelliJ IDEA.
Your IntelliJ IDEA environment is now configured to communicate with MinIO. You can extend the example code to build a full application using the MinIO Java client.